class LayoutBuilderLocalTaskDeriver in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/src/Plugin/Derivative/LayoutBuilderLocalTaskDeriver.php \Drupal\layout_builder\Plugin\Derivative\LayoutBuilderLocalTaskDeriver
- 10 core/modules/layout_builder/src/Plugin/Derivative/LayoutBuilderLocalTaskDeriver.php \Drupal\layout_builder\Plugin\Derivative\LayoutBuilderLocalTaskDeriver
Provides local task definitions for the layout builder user interface.
@todo Remove this in https://www.drupal.org/project/drupal/issues/2936655.
@internal Plugin derivers are internal.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\layout_builder\Plugin\Derivative\LayoutBuilderLocalTaskDeriver implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of LayoutBuilderLocalTaskDeriver
1 string reference to 'LayoutBuilderLocalTaskDeriver'
- layout_builder.links.task.yml in core/
modules/ layout_builder/ layout_builder.links.task.yml - core/modules/layout_builder/layout_builder.links.task.yml
File
- core/
modules/ layout_builder/ src/ Plugin/ Derivative/ LayoutBuilderLocalTaskDeriver.php, line 21
Namespace
Drupal\layout_builder\Plugin\DerivativeView source
class LayoutBuilderLocalTaskDeriver extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The section storage manager.
*
* @var \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface
*/
protected $sectionStorageManager;
/**
* Constructs a new LayoutBuilderLocalTaskDeriver.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface $section_storage_manager
* The section storage manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, SectionStorageManagerInterface $section_storage_manager) {
$this->entityTypeManager = $entity_type_manager;
$this->sectionStorageManager = $section_storage_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity_type.manager'), $container
->get('plugin.manager.layout_builder.section_storage'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this->sectionStorageManager
->getDefinitions() as $plugin_id => $definition) {
$section_storage = $this->sectionStorageManager
->loadEmpty($plugin_id);
if ($section_storage instanceof SectionStorageLocalTaskProviderInterface) {
$this->derivatives += $section_storage
->buildLocalTasks($base_plugin_definition);
}
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
LayoutBuilderLocalTaskDeriver:: |
protected | property | The entity type manager. | |
LayoutBuilderLocalTaskDeriver:: |
protected | property | The section storage manager. | |
LayoutBuilderLocalTaskDeriver:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
LayoutBuilderLocalTaskDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
LayoutBuilderLocalTaskDeriver:: |
public | function | Constructs a new LayoutBuilderLocalTaskDeriver. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |