function config_translation_entity_operation
Same name in other branches
- 8.9.x core/modules/config_translation/config_translation.module \config_translation_entity_operation()
- 10 core/modules/config_translation/config_translation.module \config_translation_entity_operation()
- 11.x core/modules/config_translation/config_translation.module \config_translation_entity_operation()
Implements hook_entity_operation().
File
-
core/
modules/ config_translation/ config_translation.module, line 156
Code
function config_translation_entity_operation(EntityInterface $entity) {
$operations = [];
$entity_type = $entity->getEntityType();
if ($entity_type->entityClassImplements(ConfigEntityInterface::class) && $entity->hasLinkTemplate('config-translation-overview') && \Drupal::currentUser()->hasPermission('translate configuration')) {
$link_template = 'config-translation-overview';
if ($entity instanceof FieldConfigInterface) {
$link_template = "config-translation-overview.{$entity->getTargetEntityTypeId()}";
}
$operations['translate'] = [
'title' => t('Translate'),
'weight' => 50,
'url' => $entity->toUrl($link_template),
];
}
return $operations;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.