function views_bulk_operations_form_alter

cis7 views_bulk_operations.module views_bulk_operations_form_alter(&$form, &$form_state, $form_id)
cle7 views_bulk_operations.module views_bulk_operations_form_alter(&$form, &$form_state, $form_id)
elmsmedia7 views_bulk_operations.module views_bulk_operations_form_alter(&$form, &$form_state, $form_id)
icor7 views_bulk_operations.module views_bulk_operations_form_alter(&$form, &$form_state, $form_id)
meedjum_blog7 views_bulk_operations.module views_bulk_operations_form_alter(&$form, &$form_state, $form_id)
mooc7 views_bulk_operations.module views_bulk_operations_form_alter(&$form, &$form_state, $form_id)

Implements hook_form_alter().

File

sites/all/modules/ulmus/views_bulk_operations/views_bulk_operations.module, line 296
Allows operations to be performed on items selected in a view.

Code

function views_bulk_operations_form_alter(&$form, &$form_state, $form_id) {
  if (strpos($form_id, 'views_form_') === 0) {
    $vbo = _views_bulk_operations_get_field($form_state['build_info']['args'][0]);
  }
  // Not a VBO-enabled views form.
  if (empty($vbo)) {
    return;
  }

  // Add basic VBO functionality.
  if ($form_state['step'] == 'views_form_views_form') {
    // The submit button added by Views Form API might be used by a non-VBO Views
    // Form handler. If there's no such handler on the view, hide the button.
    $has_other_views_form_handlers = FALSE;
    foreach ($vbo->view->field as $field) {
      if (property_exists($field, 'views_form_callback') || method_exists($field, 'views_form')) {
        if (!($field instanceof views_bulk_operations_handler_field_operations)) {
          $has_other_views_form_handlers = TRUE;
        }
      }
    }
    if (!$has_other_views_form_handlers) {
      $form['actions']['#access'] = FALSE;
    }
    // The VBO field is excluded from display, stop here.
    if (!empty($vbo->options['exclude'])) {
      return;
    }

    $form = views_bulk_operations_form($form, $form_state, $vbo);
  }

  // Cache the built form to prevent it from being rebuilt prior to validation
  // and submission, which could lead to data being processed incorrectly,
  // because the views rows (and thus, the form elements as well) have changed
  // in the meantime. Matching views issue: http://drupal.org/node/1473276.
  $form_state['cache'] = TRUE;

  if (empty($vbo->view->override_url)) {
    // If the VBO view is embedded using views_embed_view(), or in a block,
    // $view->get_url() doesn't point to the current page, which means that
    // the form doesn't get processed.
    if (!empty($vbo->view->preview) || $vbo->view->display_handler instanceof views_plugin_display_block) {
      $vbo->view->override_url = $_GET['q'];
      // We are changing the override_url too late, the form action was already
      // set by Views to the previous URL, so it needs to be overriden as well.
      $query = drupal_get_query_parameters($_GET, array('q'));
      $form['#action'] = url($_GET['q'], array('query' => $query));
    }
  }

  // Give other modules a chance to alter the form.
  drupal_alter('views_bulk_operations_form', $form, $form_state, $vbo);
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.