You are here

public function StateTransitionForm::getFormId in State Machine 8

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

File

src/Form/StateTransitionForm.php, line 66

Class

StateTransitionForm

Namespace

Drupal\state_machine\Form

Code

public function getFormId() {
  $entity = $this
    ->getEntity();
  if (!$entity) {
    throw new \RuntimeException('No entity provided to StateTransitionForm.');
  }

  // Example ID: "state_machine_transition_form_commerce_order_state_1".
  $form_id = $this
    ->getBaseFormId();
  $form_id .= '_' . $entity
    ->getEntityTypeId() . '_' . $this->fieldName;
  $form_id .= '_' . $entity
    ->id();
  return $form_id;
}