public function DemoDeleteConfirm::buildForm in Demonstration site (Sandbox / Snapshot) 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
- src/
Form/ DemoDeleteConfirm.php, line 26
Class
- DemoDeleteConfirm
- This class return the demo_delete_confirm, a form where you will be asked to be sure to delete your config file.
Namespace
Drupal\demo\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $filename = NULL) {
$fileconfig = demo_get_fileconfig($filename);
if (!file_exists($fileconfig['infofile'])) {
\Drupal::messenger()
->addMessage(t('File not found'), 'error');
}
$form['filename'] = [
'#type' => 'value',
'#value' => $filename,
];
return parent::buildForm($form, $form_state);
}