public function ViewsBulkOperationsFormTrait::cancelForm in Views Bulk Operations (VBO) 8.3
Same name and namespace in other branches
- 8.2 src/Form/ViewsBulkOperationsFormTrait.php \Drupal\views_bulk_operations\Form\ViewsBulkOperationsFormTrait::cancelForm()
- 4.0.x src/Form/ViewsBulkOperationsFormTrait.php \Drupal\views_bulk_operations\Form\ViewsBulkOperationsFormTrait::cancelForm()
Submit callback to cancel an action and return to the view.
Parameters
array $form: The form definition.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
File
- src/
Form/ ViewsBulkOperationsFormTrait.php, line 264
Class
- ViewsBulkOperationsFormTrait
- Defines common methods for Views Bulk Operations forms.
Namespace
Drupal\views_bulk_operations\FormCode
public function cancelForm(array &$form, FormStateInterface $form_state) {
$form_data = $form_state
->get('views_bulk_operations');
$this
->messenger()
->addMessage($this
->t('Canceled "%action".', [
'%action' => $form_data['action_label'],
]));
$form_state
->setRedirectUrl($form_data['redirect_url']);
}