You are here

public function FormModeManagerLocalAction::setDefaultLocalTask in Form mode manager 8

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

Set default local task.

Parameters

array $form_mode: A form mode.

string $entity_type_id: An entity type id.

string $form_mode_name: A form mode name.

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

File

src/Plugin/Derivative/FormModeManagerLocalAction.php, line 83

Class

FormModeManagerLocalAction
Provides local action definitions for all entity bundles.

Namespace

Drupal\form_mode_manager\Plugin\Derivative

Code

public function setDefaultLocalTask(array $form_mode, $entity_type_id, $form_mode_name) {
  $this->derivatives[$form_mode['id']] = [
    'route_name' => "form_mode_manager.{$entity_type_id}.add_page.{$form_mode_name}",
    'title' => $this
      ->t('Add @entity_label as @form_mode', [
      '@form_mode' => $form_mode['label'],
      '@entity_label' => $entity_type_id,
    ]),
    'route_parameters' => [
      'form_mode_name' => $form_mode_name,
    ],
    'appears_on' => [
      "entity.{$entity_type_id}.collection",
    ],
    'cache_tags' => $this->formModeManager
      ->getListCacheTags(),
  ];
}