You are here

public function MenuLinksAction::getDerivativeDefinitions in Entity Extra Field 8

Same name and namespace in other branches
  1. 2.0.x modules/entity_extra_field_ui/src/Plugin/Derivative/MenuLinksAction.php \Drupal\entity_extra_field_ui\Plugin\Derivative\MenuLinksAction::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

modules/entity_extra_field_ui/src/Plugin/Derivative/MenuLinksAction.php, line 45

Class

MenuLinksAction
Define menu links action derivative.

Namespace

Drupal\entity_extra_field_ui\Plugin\Derivative

Code

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;
}