You are here

public function DsDevelLocalTask::getDerivativeDefinitions in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 modules/ds_devel/src/Plugin/Derivative/DsDevelLocalTask.php \Drupal\ds_devel\Plugin\Derivative\DsDevelLocalTask::getDerivativeDefinitions()
  2. 8.3 modules/ds_devel/src/Plugin/Derivative/DsDevelLocalTask.php \Drupal\ds_devel\Plugin\Derivative\DsDevelLocalTask::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/ds_devel/src/Plugin/Derivative/DsDevelLocalTask.php, line 52

Class

DsDevelLocalTask
Provides local task definitions for all entity bundles.

Namespace

Drupal\ds_devel\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = [];
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    $has_markup_path = $entity_type
      ->hasLinkTemplate('devel-markup');
    if ($has_markup_path) {
      $this->derivatives["{$entity_type_id}.devel_markup_tab"] = [
        'route_name' => "entity.{$entity_type_id}.devel_markup",
        'weight' => 100,
        'title' => $this
          ->t('Markup'),
        'parent_id' => "devel.entities:{$entity_type_id}.devel_tab",
      ];
    }
  }
  foreach ($this->derivatives as &$entry) {
    $entry += $base_plugin_definition;
  }
  return $this->derivatives;
}