W3cubDocs

/Drupal 8

public function EntityForm::getFormId

public EntityForm::getFormId()

Returns a unique string identifying the form.

Return value

string The unique string identifying the form.

Overrides FormInterface::getFormId

File

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

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

© 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::getFormId/8.1.x