diff --git a/config_translation.module b/config_translation.module index 916fcf5..26f06a0 100644 --- a/config_translation.module +++ b/config_translation.module @@ -267,6 +267,18 @@ function config_translation_config_translation_group_info() { } /** + * Implements hook_entity_operations_alter(). + */ +function config_translation_entity_operations_alter(array &$operations, \Drupal\Core\Entity\EntityInterface $entity) { + $uri = $entity->uri(); + $operations['translate'] = array( + 'title' => t('Translate badabumm'), + 'href' => $uri['path'] . '/translate', + 'weight' => 50, + ); +} + +/** * Goddamn ugly operations altering since there is no operations API. * * @todo @@ -315,18 +327,6 @@ function config_translation_form_alter(&$form, &$form_state, $form_id) { } } - // Alter the taxonomy form to add translation links. - if ($form_id == 'taxonomy_overview_vocabularies') { - foreach ($form as $id => &$vocabulary) { - if (is_array($vocabulary) && isset($vocabulary['operations'])) { - $vocabulary['operations']['#links']['translate'] = array( - 'title' => t('Translate'), - 'href' => 'admin/structure/taxonomy/' . $id . '/translate', - ); - } - } - } - } /**