public function StateTransitionConfirmForm::buildForm in State Machine 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ContentEntityConfirmFormBase::buildForm
File
- src/
Form/ StateTransitionConfirmForm.php, line 54
Class
- StateTransitionConfirmForm
- Provides a confirmation form for performing an entity state transition.
Namespace
Drupal\state_machine\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $field_name = '', $transition_id = '') {
/** @var \Drupal\state_machine\Plugin\Field\FieldType\StateItemInterface $state_item */
$state_item = $this->entity
->get($field_name)
->first();
$transition = $state_item
->getWorkflow()
->getTransition($transition_id);
$this->fieldName = $field_name;
$this->transition = $transition;
return parent::buildForm($form, $form_state);
}