You are here

function cacheflush_ui_views_query_alter in CacheFlush 8

Implements hook_views_query_alter().

File

modules/cacheflush_ui/cacheflush_ui.module, line 118
Cacheflush User Interface.

Code

function cacheflush_ui_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
  if ($view
    ->id() == 'cacheflush_content') {
    $account = \Drupal::currentUser();
    if ($account
      ->hasPermission('cacheflush view any')) {
      foreach ($query->where as $key => &$condition_group) {
        foreach ($condition_group['conditions'] as &$condition) {
          if ($condition['field'] == 'cacheflush.uid = :cacheflush_uid ') {
            unset($query->where[$key]);
          }
        }
      }
    }
  }
}