You are here

public function FormModeManagerLinksForm::buildFormPerEntity in Form mode manager 8.2

Build form element per compatible entities.

Parameters

array $form: An associative array containing the structure of the form.

array $form_modes: The form modes collection for given entity type.

string $entity_type_id: The entity type ID of entity.

Return value

string The name of the theme

Overrides FormModeManagerFormBase::buildFormPerEntity

File

src/Form/FormModeManagerLinksForm.php, line 79

Class

FormModeManagerLinksForm
Configure Form Mode Manager links.

Namespace

Drupal\form_mode_manager\Form

Code

public function buildFormPerEntity(array &$form, array $form_modes, $entity_type_id) {
  $entity_label = $this->entityTypeManager
    ->getStorage($entity_type_id)
    ->getEntityType()
    ->getLabel();
  $form['local_taks']["{$entity_type_id}_local_taks"] = [
    '#type' => 'details',
    '#title' => $entity_label,
    '#description' => $this
      ->t('The following options are available for make a better flexibility of local task displaying.'),
    '#group' => 'vertical_tabs',
  ];
  $form['local_taks']["{$entity_type_id}_local_taks"]['tasks_location_' . $entity_type_id] = [
    '#title' => $this
      ->t('Position of Local tasks'),
    '#type' => 'select',
    '#options' => $this->localTaskTypes,
    '#default_value' => $this->settings
      ->get("local_tasks.{$entity_type_id}.position"),
    '#description' => $this
      ->t('The location of local tasks. <ul><li><b>Primary level</b> are at the same position as "Edit" default task</li><li><b>Secondary</b> level place all form-modes tasks below "Edit" task (at secondary menu). </li></ul>'),
    '#weight' => 0,
  ];
  return $this;
}