This project is not covered by Drupal’s security advisory policy.

The module provides additional features to solve non-standard tasks for the vbo module (>= 8.x-3.x).

Features:

  • Configuring selection info
  • Configuring actions position
  • Changing logic of the Select all checkbox
  • Fixing behavior of modified checkboxes (e.g. bootstrap theme)
  • Adding custom actions in the form and performing actions for selected items (needing to write custom code)

Basic example a custom action:

/**
 * Implements hook_vbo_extra_form_alter().
 */
function MODULE_vbo_extra_form_alter(&$form, FormStateInterface $form_state, FieldHandlerInterface $views_field) {
  $build_info = $form_state->getBuildInfo();
  if ($build_info['form_id'] == 'views_form_VIEW_ID_DISPLAY_ID') {
    $element_id = 'views_bulk_operations_bulk_form';

    $class = new ModuleVboFormAlter();
    $form['header'][$element_id]['actions']['export'] = [
      '#type' => 'submit',
      '#value' => 'Export',
      '#submit' => [
        [$views_field, 'liteFormSubmit'],
        [$class, 'submitExportForm'],
      ],
    ];
  }
}

// From ModuleVboFormAlter class.

class ModuleVboFormAlter {

  use VboExtraCustomActionTrait;

  public function submitExportForm(array $form, FormStateInterface $form_state) {
    $view = $form_state->getBuildInfo()['args'][0];
    $select_all = $form_state->getValue('select_all');

    // Using a vbo extra trait.
    $this->setView($view);
    $rows = $this->executeAction($select_all);

    // Custom ...
    $this->doSomething($rows);
  }

  /**
   * Processes action for an entity of results.
   */
  protected function processEntity(EntityInterface $entity) {
    $row = [];
    $row[] = Link::fromTextAndUrl($entity->label(), $entity->toUrl()->toString());
    $row[] = $entity->get('field_employee_size')->value;
    return $row;
  }
}

Project information

  • caution Seeking new maintainer
    The current maintainers are looking for new people to take ownership.
  • caution Maintenance fixes only
    Considered feature-complete by its maintainers.
  • Project categories: Administration tools
  • Created by m.lebedev on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases