You are here

function regcode_views_default_views_alter in Registration codes 8

Same name and namespace in other branches
  1. 7.2 regcode.views.inc \regcode_views_default_views_alter()
  2. 7 regcode.views.inc \regcode_views_default_views_alter()

Implements hook_views_default_views().

File

./regcode.views.inc, line 204
Views integration for regcode module.

Code

function regcode_views_default_views_alter(&$views) {
  if (isset($views['regcode']) && \Drupal::moduleHandler()
    ->moduleExists('views_bulk_operations')) {
    $view = $views['regcode'];
    $handler = $view->display['default'];
    $newfields = [];

    // Field: Bulk operations: Regcode.
    $newfields['views_bulk_operations']['id'] = 'views_bulk_operations';
    $newfields['views_bulk_operations']['table'] = 'regcode';
    $newfields['views_bulk_operations']['field'] = 'views_bulk_operations';
    $newfields['views_bulk_operations']['label'] = '';
    $newfields['views_bulk_operations']['element_label_colon'] = FALSE;
    $newfields['views_bulk_operations']['vbo_settings']['display_type'] = '0';
    $newfields['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1;
    $newfields['views_bulk_operations']['vbo_settings']['force_single'] = 0;
    $newfields['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10';
    $newfields['views_bulk_operations']['vbo_operations'] = [
      'action::regcode_activate_action' => [
        'selected' => 1,
        'postpone_processing' => 0,
        'skip_confirmation' => 0,
        'override_label' => 0,
        'label' => '',
      ],
      'action::regcode_deactivate_action' => [
        'selected' => 1,
        'postpone_processing' => 0,
        'skip_confirmation' => 0,
        'override_label' => 0,
        'label' => '',
      ],
      'action::regcode_delete_action' => [
        'selected' => 1,
        'postpone_processing' => 0,
        'skip_confirmation' => 0,
        'override_label' => 0,
        'label' => '',
      ],
      'action::regcode_mailer_mail_action' => [
        'selected' => 1,
        'postpone_processing' => 0,
        'skip_confirmation' => 0,
        'override_label' => 0,
        'label' => '',
      ],
      'action::regcode_tag_action' => [
        'selected' => 1,
        'postpone_processing' => 0,
        'skip_confirmation' => 0,
        'override_label' => 0,
        'label' => '',
      ],
    ];
    $handler->display_options['fields'] = $newfields + $handler->display_options['fields'];
  }
}