function EntityForm::getBaseFormId

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::getBaseFormId()
  2. 10 core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::getBaseFormId()
  3. 11.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::getBaseFormId()

Overrides BaseFormIdInterface::getBaseFormId

6 methods override EntityForm::getBaseFormId()
BookOutlineForm::getBaseFormId in core/modules/book/src/Form/BookOutlineForm.php
Returns a string identifying the base form.
ContentEntityConfirmFormBase::getBaseFormId in core/lib/Drupal/Core/Entity/ContentEntityConfirmFormBase.php
Returns a string identifying the base form.
DefaultsEntityForm::getBaseFormId in core/modules/layout_builder/src/Form/DefaultsEntityForm.php
Returns a string identifying the base form.
EntityConfirmFormBase::getBaseFormId in core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php
Returns a string identifying the base form.
OverridesEntityForm::getBaseFormId in core/modules/layout_builder/src/Form/OverridesEntityForm.php
Returns a string identifying the base form.

... See full list

File

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.