You are here

function auto_entitylabel_form_alter in Automatic Entity Label 8.3

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

Implements hook_form_alter().

File

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

Code

function auto_entitylabel_form_alter(&$form, FormStateInterface $form_state) {
  if (isset($form['#entity_builders'])) {

    /** @var \Drupal\Core\Entity\EntityFormInterface $formObject */
    $formObject = $form_state
      ->getFormObject();
    $entity = $formObject
      ->getEntity();
    if ($entity instanceof ContentEntityInterface) {
      auto_entitylabel_prepare_entityform($form, $entity);
    }
  }
}