You are here

public function ViewsBulkOperationsFormTrait::cancelForm in Views Bulk Operations (VBO) 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/ViewsBulkOperationsFormTrait.php \Drupal\views_bulk_operations\Form\ViewsBulkOperationsFormTrait::cancelForm()
  2. 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 191

Class

ViewsBulkOperationsFormTrait
Defines common methods for Views Bulk Operations forms.

Namespace

Drupal\views_bulk_operations\Form

Code

public function cancelForm(array &$form, FormStateInterface $form_state) {
  $form_data = $form_state
    ->get('views_bulk_operations');
  drupal_set_message($this
    ->t('Canceled "%action".', [
    '%action' => $form_data['action_label'],
  ]));
  $form_state
    ->setRedirectUrl($form_data['redirect_url']);
}