Skip to content

Commit

Permalink
Merge pull request #243 from quantcdn/feature/views-exposed-filter-wa…
Browse files Browse the repository at this point in the history
…rning

Show admin warning on pages with views with exposed filters
  • Loading branch information
kepol authored Jan 29, 2025
2 parents 230286f + 9f22756 commit ee07f01
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions quant.module
Original file line number Diff line number Diff line change
Expand Up @@ -501,3 +501,16 @@ function quant_preprocess_views_view_table(&$variables) {
}
}
}

/**
* Implements hook_preprocess_views_view().
*/
function quant_preprocess_views_view(array &$variables) {
/** @var \Drupal\views\ViewExecutable $view */
$view = $variables['view'];

// If the view has exposed filters, add a warning for admins.
if ($view->exposed_data && \Drupal::currentUser()->hasRole('administrator')) {
\Drupal::messenger()->addWarning(t('The view (@view_id) on this page has exposed filters which need special handling for a static website.<br/> <a href="https://docs.quantcdn.io/integrations/drupal">See the documentation for your options</a>.', ['@view_id' => $view->id()]));
}
}

0 comments on commit ee07f01

Please sign in to comment.