Custom 'no results' handler in Drupal 8 Views.
I recently had a requirement to have different 'no results' text display under different circumstances on a Drupal 8 site I was working on. It was much simpler than I thought and I'll share the text snippet I used. /** * Implements hook_views_pre_view(). */ function my_module_views_pre_view(ViewExecutable $view, $display_id, array &$args) { if ($view->id() == 'james_davidson_view' && $display_id === 'page') { $message = t("I'm sorry there are...