From c26700ad7128b866e81054b97564e3d8b8f07a99 Mon Sep 17 00:00:00 2001
From: Daniel Wehner <daniel.wehner@erdfisch.de>
Date: Fri, 18 May 2012 22:51:49 +0200
Subject: [PATCH] Issue #1578028 by dawehner: Change the way the exposed form
 in block AJAX message is done.

---
 plugins/views_plugin_display_block.inc | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/plugins/views_plugin_display_block.inc b/plugins/views_plugin_display_block.inc
index 45acd0845972..20331007e1a3 100644
--- a/plugins/views_plugin_display_block.inc
+++ b/plugins/views_plugin_display_block.inc
@@ -125,7 +125,6 @@ function get_cache_type() {
    * Provide the default form for setting options.
    */
   function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
     // It is very important to call the parent function here:
     parent::options_form($form, $form_state);
 
@@ -148,6 +147,14 @@ function options_form(&$form, &$form_state) {
           '#default_value' => $this->get_cache_type(),
         );
         break;
+      case 'exposed_form_options':
+        $this->view->init_handlers();
+        if (!$this->uses_exposed() && parent::uses_exposed()) {
+          $form['exposed_form_options']['warning'] = array(
+            '#weight' => -10,
+            '#markup' => '<div class="messages warning">' . t('Exposed filters in block displays require "Use AJAX" to be set to work correctly.') . '</div>',
+          );
+        }
     }
   }
 
@@ -179,10 +186,6 @@ function uses_exposed() {
       if ($this->use_ajax()) {
         return parent::uses_exposed();
       }
-      //Warn user that for blocks, exposed filters only work with AJAX.
-      if (parent::uses_exposed()) {
-        drupal_set_message(t('Exposed filters in block displays require "Use AJAX" to be set to work correctly.'),'error',FALSE);
-      }
       return FALSE;
     }
 
-- 
GitLab