You are here

private function FormModeManagerLocalTasks::setFormModesTasks in Form mode manager 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Derivative/FormModeManagerLocalTasks.php \Drupal\form_mode_manager\Plugin\Derivative\FormModeManagerLocalTasks::setFormModesTasks()

Set the default tasks on each entities.

Parameters

array $form_mode: An associative array represent a DisplayForm entity.

string $entity_type_id: The entity type ID.

bool $is_primary_tasks: True if we need to place tasks on primary level.

1 call to FormModeManagerLocalTasks::setFormModesTasks()
FormModeManagerLocalTasks::getDerivativeDefinitions in src/Plugin/Derivative/FormModeManagerLocalTasks.php
Gets the definition of all derivatives of a base plugin.

File

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

Class

FormModeManagerLocalTasks
Defines dynamic 'Form Mode Manager' local tasks.

Namespace

Drupal\form_mode_manager\Plugin\Derivative

Code

private function setFormModesTasks(array $form_mode, $entity_type_id, $is_primary_tasks) {
  $this
    ->setFormModesTasksBase($form_mode, $entity_type_id);
  $this
    ->setUserRegisterTasks($form_mode, $entity_type_id);
  $element_name = "form_mode_manager.{$form_mode['id']}.task_tab";
  $this
    ->blockContentEnhancer($element_name, $entity_type_id, FALSE);

  // Evaluate if tasks does be displayed at the primary level.
  if ($is_primary_tasks) {
    $this->derivatives[$element_name]['base_route'] = "entity.{$entity_type_id}.canonical";
    unset($this->derivatives[$element_name]['parent_id']);
  }
}