You are here

private static function EntityViewDisplayAlterer::getViewDisplayEntityFromFormState in Smart Title 8

Gets the entity view display from the given form state.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

Return value

\Drupal\Core\Entity\Display\EntityViewDisplayInterface|null The entity view display entity from the form state, or NULL if cannot be retrieved one.

2 calls to EntityViewDisplayAlterer::getViewDisplayEntityFromFormState()
EntityViewDisplayAlterer::addSmartTitle in src/EntityViewDisplayAlterer.php
Adds Smart Title to the entity form.
EntityViewDisplayAlterer::submitSmartTitleForm in src/EntityViewDisplayAlterer.php
Submit callback for saving the smart title configuration.

File

src/EntityViewDisplayAlterer.php, line 433

Class

EntityViewDisplayAlterer
Entity view display form alterer class for Smart Title.

Namespace

Drupal\smart_title

Code

private static function getViewDisplayEntityFromFormState(FormStateInterface $form_state) {
  if (!$form_state
    ->getFormObject() instanceof EntityFormInterface) {
    return NULL;
  }
  $entity = $form_state
    ->getFormObject()
    ->getEntity();
  return $entity instanceof EntityViewDisplayInterface ? $entity : NULL;
}