You are here

public function RdfUiLocalTask::getDerivativeDefinitions in Schema.org configuration tool (RDF UI) 8

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

src/Plugin/Derivative/RdfUiLocalTask.php, line 64

Class

RdfUiLocalTask
Provides local task definitions for all entity bundles.

Namespace

Drupal\rdfui\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = [];
  $entity_type_ids = [
    'user',
    'node',
    'comment',
    'taxonomy_term',
  ];
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if ($entity_type
      ->get('field_ui_base_route') && in_array($entity_type_id, $entity_type_ids)) {
      $this->derivatives["overview_{$entity_type_id}"] = array(
        'route_name' => "entity.{$entity_type_id}.field_ui_fields",
        'title' => $this
          ->t('Fields'),
        'parent_id' => "field_ui.fields:overview_{$entity_type_id}",
      );
      $this->derivatives["rdf_{$entity_type_id}"] = array(
        'route_name' => "entity.{$entity_type_id}.rdf_ui_fields",
        'weight' => 2,
        'title' => $this
          ->t('RDF Mappings'),
        'parent_id' => "field_ui.fields:overview_{$entity_type_id}",
      );
    }
  }
  foreach ($this->derivatives as &$entry) {
    $entry += $base_plugin_definition;
  }
  return $this->derivatives;
}