You are here

public function FormModeManagerLocalTasks::getDerivativeDefinitions in Form mode manager 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Derivative/FormModeManagerLocalTasks.php \Drupal\form_mode_manager\Plugin\Derivative\FormModeManagerLocalTasks::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

src/Plugin/Derivative/FormModeManagerLocalTasks.php, line 68

Class

FormModeManagerLocalTasks
Defines dynamic 'Form Mode Manager' local tasks.

Namespace

Drupal\form_mode_manager\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = [];
  foreach ($this->formModesDefinitionsList as $entity_type_id => $form_modes) {
    $this
      ->setDefaultTasks($entity_type_id);
    foreach ($form_modes as $form_mode_name => $form_mode) {
      if ($this->formModeManager
        ->hasActiveFormMode($entity_type_id, $form_mode_name)) {
        $this
          ->setFormModesTasks($form_mode, $entity_type_id, $this->formModeManager
          ->tasksIsPrimary($entity_type_id));
      }
    }
  }
  foreach ($this->derivatives as &$entry) {
    $entry += $base_plugin_definition;
  }
  return $this->derivatives;
}