You are here

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

Alters the base_route definition for RDF UI local tasks.

Parameters

array $local_tasks: An array of local tasks plugin definitions, keyed by plugin ID.

File

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

Class

RdfUiLocalTask
Provides local task definitions for all entity bundles.

Namespace

Drupal\rdfui\Plugin\Derivative

Code

public function alterLocalTasks(array &$local_tasks) {
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if ($route_name = $entity_type
      ->get('field_ui_base_route') && ($entity_type_id === "node" || $entity_type_id === "user")) {
      $local_tasks["field_ui.fields:rdf_{$entity_type_id}"]['base_route'] = $route_name;
      $local_tasks["field_ui.fields:overview_{$entity_type_id}"]['base_route'] = $route_name;
    }
  }
}