public function ConfirmAction::buildForm in Views Bulk Operations (VBO) 8.3
Same name and namespace in other branches
- 8 src/Form/ConfirmAction.php \Drupal\views_bulk_operations\Form\ConfirmAction::buildForm()
- 8.2 src/Form/ConfirmAction.php \Drupal\views_bulk_operations\Form\ConfirmAction::buildForm()
- 4.0.x src/Form/ConfirmAction.php \Drupal\views_bulk_operations\Form\ConfirmAction::buildForm()
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/ ConfirmAction.php, line 81
Class
- ConfirmAction
- Default action execution confirmation form.
Namespace
Drupal\views_bulk_operations\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $view_id = NULL, $display_id = NULL) {
$form_data = $this
->getFormData($view_id, $display_id);
// TODO: display an error msg, redirect back.
if (!isset($form_data['action_id'])) {
return;
}
$form['list'] = $this
->getListRenderable($form_data);
$form['#title'] = $this
->formatPlural($form_data['selected_count'], 'Are you sure you wish to perform "%action" action on 1 entity?', 'Are you sure you wish to perform "%action" action on %count entities?', [
'%action' => $form_data['action_label'],
'%count' => $form_data['selected_count'],
]);
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Execute action'),
'#submit' => [
[
$this,
'submitForm',
],
],
];
$this
->addCancelButton($form);
$form_state
->set('views_bulk_operations', $form_data);
return $form;
}