public function BulkFormBase::views_form_submit

Submit handler for the bulk form.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: An associative array containing the current state of the form.

2 calls to BulkFormBase::views_form_submit()
BulkForm::views_form_submit in drupal/core/modules/action/lib/Drupal/action/Plugin/views/field/BulkForm.php
Implements \Drupal\system\Plugin\views\field\BulkFormBase::views_form_submit().
NodeBulkForm::views_form_submit in drupal/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php
Submit handler for the bulk form.
2 methods override BulkFormBase::views_form_submit()
BulkForm::views_form_submit in drupal/core/modules/action/lib/Drupal/action/Plugin/views/field/BulkForm.php
Implements \Drupal\system\Plugin\views\field\BulkFormBase::views_form_submit().
NodeBulkForm::views_form_submit in drupal/core/modules/node/lib/Drupal/node/Plugin/views/field/NodeBulkForm.php
Submit handler for the bulk form.

File

drupal/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php, line 151
Contains \Drupal\system\Plugin\views\field\BulkFormBase.

Class

BulkFormBase
Defines a generic bulk operation form element.

Namespace

Drupal\system\Plugin\views\field

Code

public function views_form_submit(&$form, &$form_state) {
  if ($form_state['step'] == 'views_form_views_form') {

    // Filter only selected checkboxes.
    $selected = array_filter($form_state['values'][$this->options['id']]);
    $entities = array();
    foreach (array_intersect_key($this->view->result, $selected) as $row) {
      $entity = $this
        ->getEntity($row);
      $entities[$entity
        ->id()] = $entity;
    }
    $action = $this->actions[$form_state['values']['action']];
    $action
      ->execute($entities);
    $operation_definition = $action
      ->getPluginDefinition();
    if (!empty($operation_definition['confirm_form_path'])) {
      $form_state['redirect'] = $operation_definition['confirm_form_path'];
    }
  }
}