You are here

function content_translation_entity_operation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/content_translation/content_translation.module \content_translation_entity_operation()

Implements hook_entity_operation().

File

core/modules/content_translation/content_translation.module, line 218
Allows entities to be translated into different languages.

Code

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