Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / views_pre_execute.twig
1 /**
2  * Implements hook_views_pre_execute().
3  */
4 function {{ machine_name }}_views_pre_execute(ViewExecutable $view) {
5   // Whenever a view queries more than two tables, show a message that notifies
6   // view administrators that the query might be heavy.
7   // (This action could be performed later in the execution process, but not
8   // earlier.)
9   $account = \Drupal::currentUser();
10
11   if (count($view->query->tables) > 2 && $account->hasPermission('administer views')) {
12     drupal_set_message(t('The view %view may be heavy to execute.', ['%view' => $view->id()]), 'warning');
13   }
14 }