class FieldUiLocalAction
Same name in other branches
- 9 core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalAction.php \Drupal\field_ui\Plugin\Derivative\FieldUiLocalAction
- 8.9.x core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalAction.php \Drupal\field_ui\Plugin\Derivative\FieldUiLocalAction
- 10 core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalAction.php \Drupal\field_ui\Plugin\Derivative\FieldUiLocalAction
Provides local action definitions for all entity bundles.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Component\Plugin\Derivative\DeriverInterface
- class \Drupal\field_ui\Plugin\Derivative\FieldUiLocalAction extends \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of FieldUiLocalAction
1 string reference to 'FieldUiLocalAction'
- field_ui.links.action.yml in core/
modules/ field_ui/ field_ui.links.action.yml - core/modules/field_ui/field_ui.links.action.yml
File
-
core/
modules/ field_ui/ src/ Plugin/ Derivative/ FieldUiLocalAction.php, line 16
Namespace
Drupal\field_ui\Plugin\DerivativeView source
class FieldUiLocalAction extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The route provider to load routes by name.
*/
protected RouteProviderInterface $routeProvider;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a FieldUiLocalAction object.
*
* @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
* The route provider to load routes by name.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(RouteProviderInterface $route_provider, EntityTypeManagerInterface $entity_type_manager) {
$this->routeProvider = $route_provider;
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container->get('router.route_provider'), $container->get('entity_type.manager'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->get('field_ui_base_route')) {
$this->derivatives["field_storage_config_add_{$entity_type_id}"] = [
'route_name' => "field_ui.field_storage_config_add_{$entity_type_id}",
'title' => $this->t('Create a new field'),
'appears_on' => [
"entity.{$entity_type_id}.field_ui_fields",
],
];
$this->derivatives["field_storage_config_reuse_{$entity_type_id}"] = [
'route_name' => "field_ui.field_storage_config_reuse_{$entity_type_id}",
'title' => $this->t('Re-use an existing field'),
'appears_on' => [
"entity.{$entity_type_id}.field_ui_fields",
],
'options' => [
'attributes' => [
'class' => [
'use-ajax',
'button',
],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => '85vw',
]),
],
],
];
}
}
foreach ($this->derivatives as &$entry) {
$entry += $base_plugin_definition;
}
return $this->derivatives;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
DeriverBase::$derivatives | protected | property | List of derivative definitions. | 1 | |
DeriverBase::getDerivativeDefinition | public | function | Gets the definition of a derivative plugin. | Overrides DeriverInterface::getDerivativeDefinition | |
FieldUiLocalAction::$entityTypeManager | protected | property | The entity type manager. | ||
FieldUiLocalAction::$routeProvider | protected | property | The route provider to load routes by name. | ||
FieldUiLocalAction::create | public static | function | Creates a new class instance. | Overrides ContainerDeriverInterface::create | |
FieldUiLocalAction::getDerivativeDefinitions | public | function | Gets the definition of all derivatives of a base plugin. | Overrides DeriverBase::getDerivativeDefinitions | |
FieldUiLocalAction::__construct | public | function | Constructs a FieldUiLocalAction object. | ||
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 | |
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | ||
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | ||
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | ||
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | |
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.