W3cubDocs

/Drupal 8

function config_translation_entity_type_alter

config_translation_entity_type_alter(array &$entity_types)

Implements hook_entity_type_alter().

File

core/modules/config_translation/config_translation.module, line 75
Configuration Translation module.

Code

function config_translation_entity_type_alter(array &$entity_types) {
  /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
  foreach ($entity_types as $entity_type_id => $entity_type) {
    if ($entity_type->isSubclassOf('Drupal\Core\Config\Entity\ConfigEntityInterface')) {
      if ($entity_type_id == 'block') {
        $class = 'Drupal\config_translation\Controller\ConfigTranslationBlockListBuilder';
      }
      elseif ($entity_type_id == 'field_config') {
        $class = 'Drupal\config_translation\Controller\ConfigTranslationFieldListBuilder';
        // Will be filled in dynamically, see \Drupal\field\Entity\FieldConfig::linkTemplates().
        $entity_type->setLinkTemplate('config-translation-overview', $entity_type->getLinkTemplate('edit-form') . '/translate');
      }
      else {
        $class = 'Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder';
      }
      $entity_type->setHandlerClass('config_translation_list', $class);

      if ($entity_type->hasLinkTemplate('edit-form')) {
        $entity_type->setLinkTemplate('config-translation-overview', $entity_type->getLinkTemplate('edit-form') . '/translate');
      }
    }
  }
}

© 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!config_translation!config_translation.module/function/config_translation_entity_type_alter/8.1.x