You are here

protected function FormHelper::getFormEntity in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 src/Form/FormHelper.php \Drupal\simple_sitemap\Form\FormHelper::getFormEntity()
  2. 8.2 src/Form/FormHelper.php \Drupal\simple_sitemap\Form\FormHelper::getFormEntity()

Gets the object entity of the form if available.

Return value

\Drupal\Core\Entity\EntityBase|false Entity or FALSE if non-existent or if form operation is 'delete'.

2 calls to FormHelper::getFormEntity()
FormHelper::entityIsNew in src/Form/FormHelper.php
FormHelper::getEntityDataFromFormEntity in src/Form/FormHelper.php
Checks if this particular form is a bundle form, or a bundle instance form and gathers sitemap settings from the database.

File

src/Form/FormHelper.php, line 457

Class

FormHelper
Class FormHelper

Namespace

Drupal\simple_sitemap\Form

Code

protected function getFormEntity() {
  $form_object = $this->formState
    ->getFormObject();
  if (NULL !== $form_object && method_exists($form_object, 'getOperation') && method_exists($form_object, 'getEntity') && in_array($form_object
    ->getOperation(), self::$allowedFormOperations, TRUE)) {
    return $form_object
      ->getEntity();
  }
  return FALSE;
}