abstract class GroupContentHandlerBase in Group 8
Provides a base class for group content handlers.
Hierarchy
- class \Drupal\group\Plugin\GroupContentHandlerBase implements GroupContentHandlerInterface
Expanded class hierarchy of GroupContentHandlerBase
1 file declares its use of GroupContentHandlerBase
- GroupContentEnablerManagerTest.php in tests/
src/ Unit/ GroupContentEnablerManagerTest.php
File
- src/
Plugin/ GroupContentHandlerBase.php, line 13
Namespace
Drupal\group\PluginView source
abstract class GroupContentHandlerBase implements GroupContentHandlerInterface {
/**
* The group content enabler definition.
*
* @var array
*/
protected $definition;
/**
* The plugin ID as read from the definition.
*
* @var string
*/
protected $pluginId;
/**
* The module handler to invoke hooks on.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Constructs a GroupContentHandlerBase object.
*
* @param string $plugin_id
* The plugin ID.
* @param array $definition
* The group content enabler definition.
*/
public function __construct($plugin_id, array $definition) {
$this->pluginId = $plugin_id;
$this->definition = $definition;
}
/**
* {@inheritdoc}
*/
public static function createInstance(ContainerInterface $container, $plugin_id, array $definition) {
return new static($plugin_id, $definition);
}
/**
* Gets the module handler.
*
* @return \Drupal\Core\Extension\ModuleHandlerInterface
* The module handler.
*/
protected function moduleHandler() {
if (!$this->moduleHandler) {
$this->moduleHandler = \Drupal::moduleHandler();
}
return $this->moduleHandler;
}
/**
* Sets the module handler for this handler.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*
* @return $this
*/
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GroupContentHandlerBase:: |
protected | property | The group content enabler definition. | |
GroupContentHandlerBase:: |
protected | property | The module handler to invoke hooks on. | |
GroupContentHandlerBase:: |
protected | property | The plugin ID as read from the definition. | |
GroupContentHandlerBase:: |
public static | function |
Instantiates a new instance of this group content handler. Overrides GroupContentHandlerInterface:: |
2 |
GroupContentHandlerBase:: |
protected | function | Gets the module handler. | |
GroupContentHandlerBase:: |
public | function | Sets the module handler for this handler. | |
GroupContentHandlerBase:: |
public | function | Constructs a GroupContentHandlerBase object. |