You are here

function social_event_an_enroll_preprocess_views_view_field in Open Social 8.8

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

Implements hook_preprocess_HOOK().

File

modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module, line 72
The Social event AN enroll module.

Code

function social_event_an_enroll_preprocess_views_view_field(&$variables) {

  /** @var \Drupal\views\ViewExecutable $view */
  $view =& $variables['view'];
  if ($view
    ->id() === 'event_manage_enrollments' && $variables['field']->field === 'rendered_entity') {
    $entity =& $variables['row']->_entity;

    /** @var \Drupal\social_event_an_enroll\EventAnEnrollManager $service */
    $service = \Drupal::service('social_event_an_enroll.manager');
    if ($service
      ->isGuest($entity)) {
      $url = Url::fromUserInput('/' . drupal_get_path('module', 'social_event_an_enroll') . '/images/icon.svg');
      $variables['output'] = [
        '#theme' => 'event_an_enroll_guest',
        '#name' => $service
          ->getGuestName($entity),
        '#url' => $url,
      ];
    }
  }
}