class MenuLinksAction in Entity Extra Field 8
Same name and namespace in other branches
- 2.0.x modules/entity_extra_field_ui/src/Plugin/Derivative/MenuLinksAction.php \Drupal\entity_extra_field_ui\Plugin\Derivative\MenuLinksAction
Define menu links action derivative.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\entity_extra_field_ui\Plugin\Derivative\MenuLinksAction implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of MenuLinksAction
1 string reference to 'MenuLinksAction'
- entity_extra_field_ui.links.action.yml in modules/
entity_extra_field_ui/ entity_extra_field_ui.links.action.yml - modules/entity_extra_field_ui/entity_extra_field_ui.links.action.yml
File
- modules/
entity_extra_field_ui/ src/ Plugin/ Derivative/ MenuLinksAction.php, line 14
Namespace
Drupal\entity_extra_field_ui\Plugin\DerivativeView source
class MenuLinksAction extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Menu links task constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity_type.manager'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$links = parent::getDerivativeDefinitions($base_plugin_definition);
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $definition) {
$base_route_name = $definition
->get('field_ui_base_route');
if (!isset($base_route_name)) {
continue;
}
$links["{$entity_type_id}.extra_fields.add_form"] = [
'title' => $this
->t('Add extra field'),
'route_name' => "entity.{$entity_type_id}.extra_fields.add",
'appears_on' => [
"entity.{$entity_type_id}.extra_fields",
],
] + $base_plugin_definition;
}
return $links;
}
}
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:: |
|
MenuLinksAction:: |
protected | property | ||
MenuLinksAction:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
MenuLinksAction:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
MenuLinksAction:: |
public | function | Menu links task constructor. | |
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. |