You are here

public function YamlFormUiElementDeleteForm::buildForm in YAML Form 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 ConfirmFormBase::buildForm

File

modules/yamlform_ui/src/Form/YamlFormUiElementDeleteForm.php, line 179

Class

YamlFormUiElementDeleteForm
Form for deleting a form element.

Namespace

Drupal\yamlform_ui\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, YamlFormInterface $yamlform = NULL, $key = NULL) {
  $this->yamlform = $yamlform;
  $this->key = $key;
  $this->element = $yamlform
    ->getElement($key);
  if ($this->element === NULL) {
    throw new NotFoundHttpException();
  }

  /** @var \Drupal\yamlform\YamlFormElementManagerInterface $element_manager */
  $element_manager = \Drupal::service('plugin.manager.yamlform.element');
  $plugin_id = $element_manager
    ->getElementPluginId($this->element);
  $this->yamlformElement = $element_manager
    ->createInstance($plugin_id, $this->element);
  return parent::buildForm($form, $form_state);
}