function content_translation_entity_operation

Same name in other branches
  1. 8.9.x core/modules/content_translation/content_translation.module \content_translation_entity_operation()
  2. 10 core/modules/content_translation/content_translation.module \content_translation_entity_operation()

Implements hook_entity_operation().

File

core/modules/content_translation/content_translation.module, line 320

Code

function content_translation_entity_operation(EntityInterface $entity) {
    $operations = [];
    if ($entity->hasLinkTemplate('drupal:content-translation-overview') && content_translation_translate_access($entity)->isAllowed()) {
        $operations['translate'] = [
            'title' => t('Translate'),
            'url' => $entity->toUrl('drupal:content-translation-overview'),
            'weight' => 50,
        ];
    }
    return $operations;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.