You are here

function social_event_managers_views_pre_view in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_views_pre_view()
  2. 8.5 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_views_pre_view()
  3. 8.6 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_views_pre_view()
  4. 8.8 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_views_pre_view()
  5. 10.3.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_views_pre_view()
  6. 10.0.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_views_pre_view()
  7. 10.1.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_views_pre_view()
  8. 10.2.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_views_pre_view()

Implements hook_views_pre_view().

File

modules/social_features/social_event/modules/social_event_managers/social_event_managers.module, line 605
Contains social_event_managers.module.

Code

function social_event_managers_views_pre_view(ViewExecutable $view, $display_id, array &$args) {

  // Remove fields from the Enrollment Management tab if the user is not a
  // manager or organiser.
  if ($view
    ->id() === 'event_manage_enrollments') {
    if (!social_event_manager_or_organizer()) {
      $fields = $view->display_handler
        ->getOption('fields');
      $fields['operations_1']['exclude'] = TRUE;
      $fields['social_views_bulk_operations_bulk_form_enrollments_1']['exclude'] = TRUE;
      $view->display_handler
        ->overrideOption('fields', $fields);
    }
  }
}