function EntityForm::getFormId

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::getFormId()
  2. 10 core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::getFormId()
  3. 8.9.x core/lib/Drupal/Core/Entity/EntityForm.php \Drupal\Core\Entity\EntityForm::getFormId()
2 methods override EntityForm::getFormId()
VocabularyDeleteForm::getFormId in core/modules/taxonomy/src/Form/VocabularyDeleteForm.php
Returns a unique string identifying the form.
WorkflowStateAddForm::getFormId in core/modules/workflows/src/Form/WorkflowStateAddForm.php
Returns a unique string identifying the form.

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

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