public function ProcessorDeleteForm::buildForm in Purge 8.3
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/
purge_ui/ src/ Form/ ProcessorDeleteForm.php, line 66
Class
- ProcessorDeleteForm
- Delete processor {id}.
Namespace
Drupal\purge_ui\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$this->processor = $this->purgeProcessors
->get($form_state
->getBuildInfo()['args'][0]);
$form = parent::buildForm($form, $form_state);
// This is rendered as a modal dialog, so we need to set some extras.
$form['#attached']['library'][] = 'core/drupal.dialog.ajax';
// Update the buttons and bind callbacks.
$form['actions']['submit'] = [
'#type' => 'submit',
'#button_type' => 'primary',
'#value' => $this
->getConfirmText(),
'#ajax' => [
'callback' => '::deleteProcessor',
],
];
$form['actions']['cancel'] = [
'#type' => 'submit',
'#value' => $this
->t('No'),
'#weight' => -10,
'#ajax' => [
'callback' => '::closeDialog',
],
];
return $form;
}