You are here

function auto_entitylabel_entity_type_alter in Automatic Entity Label 8.3

Same name and namespace in other branches
  1. 8 auto_entitylabel.module \auto_entitylabel_entity_type_alter()
  2. 8.2 auto_entitylabel.module \auto_entitylabel_entity_type_alter()

Implements hook_entity_type_alter().

Adds the Auto Label tab to the entity configuration page.

File

./auto_entitylabel.module, line 36
Allows hiding of entity label fields and automatic label creation.

Code

function auto_entitylabel_entity_type_alter(array &$entity_types) {

  /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
  foreach ($entity_types as $entity_type) {
    if ($entity_type
      ->getBundleOf() && $entity_type
      ->hasLinkTemplate('edit-form')) {
      $entity_type
        ->setLinkTemplate('auto-label', $entity_type
        ->getLinkTemplate('edit-form') . "/auto-label");
    }
  }
}