You are here

public function EntityForm::getFormId in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::getFormId()
  2. 9 core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::getFormId()

Returns a unique string identifying the form.

The returned ID should be a unique string that can be a valid PHP function name, since it's used in hook implementation names such as hook_form_FORM_ID_alter().

Return value

string The unique string identifying the form.

Overrides FormInterface::getFormId

1 call to EntityForm::getFormId()
EntityForm::getBaseFormId in core/lib/Drupal/Core/Entity/EntityForm.php
Returns a string identifying the base form.
11 methods override EntityForm::getFormId()
ContentTranslationDeleteForm::getFormId in core/modules/content_translation/src/Form/ContentTranslationDeleteForm.php
Returns a unique string identifying the form.
LanguageAddForm::getFormId in core/modules/language/src/Form/LanguageAddForm.php
Returns a unique string identifying the form.
LanguageDeleteForm::getFormId in core/modules/language/src/Form/LanguageDeleteForm.php
Returns a unique string identifying the form.
LanguageEditForm::getFormId in core/modules/language/src/Form/LanguageEditForm.php
Returns a unique string identifying the form.
ShortcutDeleteForm::getFormId in core/modules/shortcut/src/Form/ShortcutDeleteForm.php
Returns a unique string identifying the form.

... See full list

File

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

Class

EntityForm
Base class for entity forms.

Namespace

Drupal\Core\Entity

Code

public function getFormId() {
  $form_id = $this->entity
    ->getEntityTypeId();
  if ($this->entity
    ->getEntityType()
    ->hasKey('bundle')) {
    $form_id .= '_' . $this->entity
      ->bundle();
  }
  if ($this->operation != 'default') {
    $form_id = $form_id . '_' . $this->operation;
  }
  return $form_id . '_form';
}