Can I combine multiple "no results behavior" to avoid repetition? I have a Search API view that has 3 attachments. This is so I can display different content type results with unique layouts.

If the user searches something too specific, they'll see the No Results Behavior up to 4 times in a row. This looks bad.

How can I only display the No Results Behavior (custom textarea) when there are no results in the view AND its 3 attachments?
I solved it myself (that's a first and probably a last)!

I'm sure this isn't the best code but it works and I don't know enough PHP to clean it up.

I disabled all "No Results Behaviors" in the view settings. I'm using the hook_preprocess_views_view hook to count the number of results for each of my attachments. Only if all 4 === 0 will it print the correct empty message.

function MYTHEMENAME_preprocess_views_view(&amp;$variables) {
  $view = $variables['view'];
  if ($view-&gt;name == 'search_results') {
    $view1 = $view2 = $view3 = $view4 = $view;

    if (is_object($view1) &amp;&amp; is_object($view2) &amp;&amp; is_object($view3) &amp;&amp; is_object($view4)) {
      $view1-&gt;setDisplay('page_1');
      $view2-&gt;setDisplay('attachment_1');
      $view3-&gt;setDisplay('attachment_2');
      $view4-&gt;setDisplay('attachment_3');

      $view1-&gt;execute();
      $view2-&gt;execute();
      $view3-&gt;execute();
      $view4-&gt;execute();

      if (count($view1-&gt;result) === 0 &amp;&amp; count($view2-&gt;result) === 0 &amp;&amp; count($view3-&gt;result === 0 &amp;&amp; count($view4-&gt;result) === 0)) {
        $variables['empty'] = "Sorry, but we couldn't find any results for your query. Try broadening your search terms.";
      }
    }
  }
}