You are here

public function AddUpdateFieldLocalAction::getDerivativeDefinitions in Scheduled Updates 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/AddUpdateFieldLocalAction.php, line 56
Contains \Drupal\scheduled_updates\Plugin\Derivative\AddUpdateFieldLocalAction.

Class

AddUpdateFieldLocalAction

Namespace

Drupal\scheduled_updates\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_id == 'scheduled_update') {
      continue;
    }
    if ($entity_type
      ->get('field_ui_base_route')) {
      $this->derivatives["scheduled_update_field_add_{$entity_type_id}"] = array(
        'route_name' => "entity.scheduled_update_type.add_form.field.{$entity_type_id}",
        'title' => $this
          ->t('Add Update field'),
        'appears_on' => array(
          "entity.{$entity_type_id}.field_ui_fields",
        ),
        'query' => [
          'entity_type_id' => $entity_type_id,
        ],
        'route_parameters' => [
          'entity_type_id' => $entity_type_id,
        ],
        'defaults' => [
          'mode' => 'embedded',
        ],
      );
    }
  }
  foreach ($this->derivatives as &$entry) {
    $entry += $base_plugin_definition;
  }
  return $this->derivatives;
}