You are here

function webform_local_tasks_alter in Webform 6.x

Same name and namespace in other branches
  1. 8.5 webform.module \webform_local_tasks_alter()

Implements hook_local_tasks_alter().

File

./webform.module, line 198
Enables the creation of webforms and questionnaires.

Code

function webform_local_tasks_alter(&$local_tasks) {

  // Change config translation local task hierarchy.
  if (isset($local_tasks['config_translation.local_tasks:entity.webform.config_translation_overview'])) {
    $local_tasks['config_translation.local_tasks:entity.webform.config_translation_overview']['base_route'] = 'entity.webform.canonical';
  }
  if (isset($local_tasks['config_translation.local_tasks:config_translation.item.overview.webform.config'])) {

    // Set weight to 110 so that the 'Translate' tab comes after
    // the 'Advanced' tab.
    // @see webform.links.task.yml
    $local_tasks['config_translation.local_tasks:config_translation.item.overview.webform.config']['weight'] = 110;
    $local_tasks['config_translation.local_tasks:config_translation.item.overview.webform.config']['parent_id'] = 'webform.config';
  }

  // Disable 'Contribute' tab if explicitly disabled or the Contribute module
  // is installed.
  if (\Drupal::config('webform.settings')
    ->get('ui.contribute_disabled') || \Drupal::moduleHandler()
    ->moduleExists('contribute')) {
    unset($local_tasks['webform.contribute']);
  }
}