content_moderation_local_tasks_alter

content_moderation_local_tasks_alter(&$local_tasks)

Implements hook_local_tasks_alter().

File

core/modules/content_moderation/content_moderation.module, line 114
Contains content_moderation.module.

Code

function content_moderation_local_tasks_alter(&$local_tasks) {
  $content_entity_type_ids = array_keys(array_filter(\Drupal::entityTypeManager()->getDefinitions(), function(EntityTypeInterface $entity_type) {
    return $entity_type->isRevisionable();
  }));

  foreach ($content_entity_type_ids as $content_entity_type_id) {
    if (isset($local_tasks["entity.$content_entity_type_id.edit_form"])) {
      $local_tasks["entity.$content_entity_type_id.edit_form"]['class'] = EditTab::class;
      $local_tasks["entity.$content_entity_type_id.edit_form"]['entity_type_id'] = $content_entity_type_id;
    }
  }
}
doc_Drupal
2016-10-29 08:58:34
Comments
Leave a Comment

Please login to continue.