public function ConfigDeleteForm::buildForm in Devel 4.x
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 FormInterface::buildForm
File
- src/
Form/ ConfigDeleteForm.php, line 26
Class
- ConfigDeleteForm
- Edit config variable form.
Namespace
Drupal\devel\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $config_name = '') {
$config = $this
->config($config_name);
if ($config === FALSE || $config
->isNew()) {
$this
->messenger()
->addError(t('Config @name does not exist in the system.', array(
'@name' => $config_name,
)));
return;
}
$form['#title'] = $this
->getQuestion();
$form['#attributes']['class'][] = 'confirmation';
$form['description'] = array(
'#markup' => $this
->getDescription(),
);
$form[$this
->getFormName()] = array(
'#type' => 'hidden',
'#value' => 1,
);
// By default, render the form using theme_confirm_form().
if (!isset($form['#theme'])) {
$form['#theme'] = 'confirm_form';
}
$form['name'] = array(
'#type' => 'value',
'#value' => $config_name,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $this
->getConfirmText(),
'#submit' => array(
array(
$this,
'submitForm',
),
),
);
$form['actions']['cancel'] = ConfirmFormHelper::buildCancelLink($this, $this
->getRequest());
return $form;
}