function content_translation_entity_operation

content_translation_entity_operation(EntityInterface $entity)

Implements hook_entity_operation().

File

core/modules/content_translation/content_translation.module, line 226
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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!content_translation!content_translation.module/function/content_translation_entity_operation/8.1.x