You are here

public function FieldUiLocalAction::getDerivativeDefinitions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalAction.php \Drupal\field_ui\Plugin\Derivative\FieldUiLocalAction::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

core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalAction.php, line 57
Contains \Drupal\field_ui\Plugin\Derivative\FieldUiLocalAction.

Class

FieldUiLocalAction
Provides local action definitions for all entity bundles.

Namespace

Drupal\field_ui\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = array();
  foreach ($this->entityManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if ($entity_type
      ->get('field_ui_base_route')) {
      $this->derivatives["field_storage_config_add_{$entity_type_id}"] = array(
        'route_name' => "field_ui.field_storage_config_add_{$entity_type_id}",
        'title' => $this
          ->t('Add field'),
        'appears_on' => array(
          "entity.{$entity_type_id}.field_ui_fields",
        ),
      );
    }
  }
  foreach ($this->derivatives as &$entry) {
    $entry += $base_plugin_definition;
  }
  return $this->derivatives;
}