function paragraphs_library_views_pre_render

Implements hook_views_pre_render().

File

paragraphs/modules/paragraphs_library/paragraphs_library.module, line 159
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;
  }
}