W3cubDocs

/Drupal 8

public function EntityForm::getBaseFormId

public EntityForm::getBaseFormId()

Returns a string identifying the base form.

Return value

string|null The string identifying the base form or NULL if this is not a base form.

Overrides BaseFormIdInterface::getBaseFormId

File

core/lib/Drupal/Core/Entity/EntityForm.php, line 72

Class

EntityForm
Base class for entity forms.

Namespace

Drupal\Core\Entity

Code

public function getBaseFormId() {
  // Assign ENTITYTYPE_form as base form ID to invoke corresponding
  // hook_form_alter(), #validate, #submit, and #theme callbacks, but only if
  // it is different from the actual form ID, since callbacks would be invoked
  // twice otherwise.
  $base_form_id = $this->entity->getEntityTypeId() . '_form';
  if ($base_form_id == $this->getFormId()) {
    $base_form_id = NULL;
  }
  return $base_form_id;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityForm.php/function/EntityForm::getBaseFormId/8.1.x