Paragraphs Editor
PluginBase.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
7 /**
8  * Provides a basic plugin base for creating paragraphs_editor plugins.
9  *
10  * This base class gives you a simple starting point for writing plugins that
11  * deal with editor command contexts. If you extend from this base you can
12  * simply access the context as a protected member variable.
13  *
14  * @code
15  * $this->context->getContextString()
16  * @endcode
17  */
18 abstract class PluginBase {
19 
20  /**
21  * The plugin id for this plugin.
22  *
23  * @var string
24  */
25  protected $pluginId;
26 
27  /**
28  * The plugin definition for this plugin.
29  *
30  * @var object
31  */
32  protected $pluginDefinition;
33 
34  /**
35  * The command context the plugin is executing within.
36  *
37  * @var \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface
38  */
39  protected $context;
40 
41  /**
42  * Creates a plugin object.
43  *
44  * @param string $plugin_id
45  * The drupal plugin id as defined in the annotation.
46  * @param object $plugin_definition
47  * The plugin definition object.
48  * @param \Drupal\paragraphs_editor\EditorCommand\CommandContextInterface $context
49  * The command context which the plugin will be executed within.
50  */
51  public function __construct($plugin_id, $plugin_definition, CommandContextInterface $context) {
52  $this->pluginId = $plugin_id;
53  $this->pluginDefinition = $plugin_definition;
54  $this->context = $context;
55  }
56 
57 }
__construct($plugin_id, $plugin_definition, CommandContextInterface $context)
Definition: PluginBase.php:51