You are here

public function MenuLinksTask::getDerivativeDefinitions in Entity Extra Field 2.0.x

Same name and namespace in other branches
  1. 8 modules/entity_extra_field_ui/src/Plugin/Derivative/MenuLinksTask.php \Drupal\entity_extra_field_ui\Plugin\Derivative\MenuLinksTask::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/MenuLinksTask.php, line 47

Class

MenuLinksTask
Define menu links task derivative.

Namespace

Drupal\entity_extra_field_ui\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) : array {
  $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"] = [
      'title' => $this
        ->t('Manage extra fields'),
      'route_name' => "entity.{$entity_type_id}.extra_fields",
      'weight' => 2,
      'base_route' => $base_route_name,
    ] + $base_plugin_definition;
  }
  return $links;
}