You are here

function social_event_managers_preprocess_views_view in Open Social 10.1.x

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_preprocess_views_view()
  2. 8.5 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_preprocess_views_view()
  3. 8.6 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_preprocess_views_view()
  4. 8.7 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_preprocess_views_view()
  5. 8.8 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_preprocess_views_view()
  6. 10.3.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_preprocess_views_view()
  7. 10.0.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_preprocess_views_view()
  8. 10.2.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_preprocess_views_view()

Implements hook_preprocess_HOOK().

File

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

Code

function social_event_managers_preprocess_views_view(&$variables) {
  if (!\Drupal::moduleHandler()
    ->moduleExists('social_event_invite')) {

    /** @var \Drupal\views\ViewExecutable $view */
    $view =& $variables['view'];

    // Remove header & VBO actions 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()) {
        unset($variables['rows']['social_views_bulk_operations_bulk_form_enrollments_1']);
        unset($variables['rows']['header']);
        unset($variables['rows']['actions']);
      }
      $block = \Drupal::entityTypeManager()
        ->getStorage('block')
        ->load('socialblue_local_actions');
      $variables['header']['actions'] = \Drupal::entityTypeManager()
        ->getViewBuilder('block')
        ->view($block);
    }
  }
}