public function SanitizerForm::buildForm in Layout Builder Block Sanitizer 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 FormInterface::buildForm
File
- src/
Form/ SanitizerForm.php, line 62
Class
- SanitizerForm
- Class SanitizerForm.
Namespace
Drupal\layout_builder_block_sanitizer\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['individual_node_sanitize'] = [
'#type' => 'fieldset',
'#title' => 'Individual node sanitization',
];
$form['individual_node_sanitize']['node_to_sanitize'] = [
'#type' => 'textfield',
'#title' => $this
->t('Node to sanitize'),
'#description' => $this
->t('Enter a node ID to sanitize non-existent blocks from it. Be sure to clear caches if blocks have recently been created.'),
'#maxlength' => 64,
'#size' => 64,
];
$form['individual_node_sanitize']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Sanitize a single node'),
];
$form['bulk_node_sanitize'] = [
'#type' => 'fieldset',
'#title' => 'Bulk node sanitization',
];
$form['bulk_node_sanitize']['sanitize_all_nodes'] = [
'#type' => 'submit',
'#submit' => [
'::batchSanitizeAllNodesStart',
],
'#value' => 'Sanitize all nodes via batch',
'#description' => $this
->t('Note that caches will be cleared during this process automatically.'),
];
return $form;
}