You are here

function auto_entitylabel_form_alter in Automatic Entity Label 8.2

Same name and namespace in other branches
  1. 8.3 auto_entitylabel.module \auto_entitylabel_form_alter()
  2. 8 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 54
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'])) {
    $entity = $form_state
      ->getFormObject()
      ->getEntity();
    if ($entity instanceof ContentEntityInterface) {
      auto_entitylabel_prepare_entityform($form, $entity);
    }
  }
}