You are here

function paragraphs_library_views_pre_render in Paragraphs 8

Implements hook_views_pre_render().

File

modules/paragraphs_library/paragraphs_library.module, line 163
Main module file for the Paragraphs Library module.

Code

function paragraphs_library_views_pre_render(ViewExecutable $view) {
  if ($view->storage
    ->id() == 'paragraphs_library' && isset($view->field['count']) && !\Drupal::currentUser()
    ->hasPermission('access entity usage statistics')) {

    // Remove link to usage statistics if user doesn't have permission to view
    // it.
    $view->field['count']->options['alter']['make_link'] = FALSE;
  }
}