You are here

private static function Simplesitemap::get_form_entity in Simple XML sitemap 8

Gets the object entity of the form if available.

Parameters

object $form_state:

Return value

object $entity or FALSE if non-existent or if form operation is 'delete'.

1 call to Simplesitemap::get_form_entity()
Simplesitemap::get_sitemap_form_entity_data in src/Simplesitemap.php
Gets the entity_type_id and bundle_name of the form object if available and only if the sitemap supports this entity type through an existing plugin.

File

src/Simplesitemap.php, line 87
Contains \Drupal\simplesitemap\Simplesitemap.

Class

Simplesitemap
Simplesitemap class.

Namespace

Drupal\simplesitemap

Code

private static function get_form_entity($form_state) {
  $form_object = $form_state
    ->getFormObject();
  if (!is_null($form_object) && method_exists($form_state
    ->getFormObject(), 'getEntity') && $form_object
    ->getOperation() !== 'delete') {
    $entity = $form_state
      ->getFormObject()
      ->getEntity();
    return $entity;
  }
  return FALSE;
}