commit facdbc26c649cc268d99c93cc992f11154cb53a4 Author: Joel Pittet Date: Wed Apr 3 19:52:57 2013 -0700 rename diff --git a/core/modules/views/css/views.base.css b/core/modules/views/css/views.base.css index 7ca2f49..15d4942 100644 --- a/core/modules/views/css/views.base.css +++ b/core/modules/views/css/views.base.css @@ -1,9 +1,9 @@ -.views-exposed-form .views-exposed-widget { +.views-view-exposed-form .views-exposed-widget { display: inline-block; } -.views-exposed-form .form-item, -.views-exposed-form .form-submit { +.views-view-exposed-form .form-item, +.views-view-exposed-form .form-submit { margin-top: 0; margin-bottom: 0; } diff --git a/core/modules/views/js/ajax_view.js b/core/modules/views/js/ajax_view.js index 5bf75bb..fe07a7d 100644 --- a/core/modules/views/js/ajax_view.js +++ b/core/modules/views/js/ajax_view.js @@ -59,7 +59,7 @@ Drupal.views.ajaxView = function(settings) { this.settings = settings; // Add the ajax to exposed forms. - this.$exposed_form = $('form#views-exposed-form-'+ settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-')); + this.$exposed_form = $('form#views-view-exposed-form-'+ settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-')); this.$exposed_form.once(jQuery.proxy(this.attachExposedFormAjax, this)); // Add the ajax to pagers. diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/Basic.php b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/Basic.php index d422867..cb5cbd2 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/Basic.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/Basic.php @@ -13,7 +13,7 @@ /** * Exposed form plugin that provides a basic exposed form. * - * @ingroup views_exposed_form_plugins + * @ingroup views_view_exposed_form_plugins * * @Plugin( * id = "basic", diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php index 1c61147..6158b1a 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php @@ -12,7 +12,7 @@ use Drupal\views\Plugin\views\PluginBase; /** - * @defgroup views_exposed_form_plugins Views exposed form plugins + * @defgroup views_view_exposed_form_plugins Views exposed form plugins * @{ * Plugins that handle the validation/submission and rendering of exposed forms. * @@ -143,7 +143,7 @@ function render_exposed_form($block = FALSE) { } $form_state['exposed_form_plugin'] = $this; - $form = drupal_build_form('views_exposed_form', $form_state); + $form = drupal_build_form('views_view_exposed_form', $form_state); $output = drupal_render($form); if (!$this->view->display_handler->displaysExposed() || (!$block && $this->view->display_handler->getOption('exposed_block'))) { diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/InputRequired.php b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/InputRequired.php index 3afcabc..634a001 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/InputRequired.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/InputRequired.php @@ -13,7 +13,7 @@ /** * Exposed form plugin that provides an exposed form with required input. * - * @ingroup views_exposed_form_plugins + * @ingroup views_view_exposed_form_plugins * * @Plugin( * id = "input_required", diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php index a573108..646d6fc 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php @@ -86,7 +86,7 @@ protected function getBasicPageView() { // In order to test exposed filters, we have to disable // the exposed forms cache. - drupal_static_reset('views_exposed_form_cache'); + drupal_static_reset('views_view_exposed_form_cache'); $view->storage->newDisplay('page', 'Page', 'page_1'); return $view; diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php index e4755bc..890a1c9 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php @@ -97,7 +97,7 @@ public function testExposedFormRender() { $exposed_form = $view->display_handler->getPlugin('exposed_form'); $this->drupalSetContent($exposed_form->render_exposed_form()); - $expected_id = drupal_clean_css_identifier('views-exposed-form-' . $view->storage->id() . '-' . $view->current_display); + $expected_id = drupal_clean_css_identifier('views-view-exposed-form-' . $view->storage->id() . '-' . $view->current_display); $this->assertFieldByXpath('//form/@id', $expected_id, 'Expected form ID found.'); $expected_action = url($view->display_handler->getUrl()); diff --git a/core/modules/views/templates/views-exposed-form.html.twig b/core/modules/views/templates/views-exposed-form.html.twig deleted file mode 100644 index 74b4d94..0000000 --- a/core/modules/views/templates/views-exposed-form.html.twig +++ /dev/null @@ -1,85 +0,0 @@ -{# -/** - * @file - * Default theme implementation of a views exposed form. - * - * Available variables: - * - widgets: An array of exposed form widgets. Each widget contains: - * - label: The sanitized label of the widget, or NULL. - * - id: The id of the widget, or an empty string. - * - operator: The rendered select element for the operator widget, - * or NULL. - * - description: The sanitized description of the widget, or NULL. - * - widget: The rendered widget itself. - * - sort_by: If defined, the rendered select element to sort the view. - * - sort_order: If 'sort_by' is defined, the rendered select element - * with the ASC, DESC options to define order. - * - items_per_page: If defined, a rendered select element for the available - * items per page. - * - offset: If defined, a textfield to define the offset of the view. - * - reset_button: If defined, a button to reset the exposed filter applied. - * - button: The submit button for the form. - * - * @ingroup themeable - * @ingroup views_templates - */ -#} -{% if q is not empty %} - {# - This ensures that, if clean URLs are off, the 'q' is added first, - as a hidden form element, so that it shows up first in the POST URL. - #} -{{ q }} -{% endif %} -
-
- {% for widget in widgets %} -
- {% if widget.label %} - - {% endif %} - {% if widget.operator %} -
- {{ widget.operator }} -
- {% endif %} -
- {{ widget.widget }} -
- {% if widget.description %} -
- {{ widget.description }} -
- {% endif %} -
- {% endfor %} - {% if sort_by is defined %} -
- {{ sort_by }} -
-
- {{ sort_order }} -
- {% endif %} - {% if items_per_page is defined %} -
- {{ items_per_page }} -
- {% endif %} - {% if offset is defined %} -
- {{ offset }} -
- {% endif %} -
- {{ button }} -
- {% if reset_button is defined %} -
- {{ reset_button }} -
- {% endif %} -
-
diff --git a/core/modules/views/templates/views-view-exposed-form.html.twig b/core/modules/views/templates/views-view-exposed-form.html.twig new file mode 100644 index 0000000..18c47a7 --- /dev/null +++ b/core/modules/views/templates/views-view-exposed-form.html.twig @@ -0,0 +1,85 @@ +{# +/** + * @file + * Default theme implementation of a views exposed form. + * + * Available variables: + * - widgets: An array of exposed form widgets. Each widget contains: + * - label: The sanitized label of the widget, or NULL. + * - id: The id of the widget, or an empty string. + * - operator: The rendered select element for the operator widget, + * or NULL. + * - description: The sanitized description of the widget, or NULL. + * - widget: The rendered widget itself. + * - sort_by: If defined, the rendered select element to sort the view. + * - sort_order: If 'sort_by' is defined, the rendered select element + * with the ASC, DESC options to define order. + * - items_per_page: If defined, a rendered select element for the available + * items per page. + * - offset: If defined, a textfield to define the offset of the view. + * - reset_button: If defined, a button to reset the exposed filter applied. + * - button: The submit button for the form. + * + * @ingroup themeable + * @ingroup views_templates + */ +#} +{% if q is not empty %} + {# + This ensures that, if clean URLs are off, the 'q' is added first, + as a hidden form element, so that it shows up first in the POST URL. + #} +{{ q }} +{% endif %} +
+
+ {% for widget in widgets %} +
+ {% if widget.label %} + + {% endif %} + {% if widget.operator %} +
+ {{ widget.operator }} +
+ {% endif %} +
+ {{ widget.widget }} +
+ {% if widget.description %} +
+ {{ widget.description }} +
+ {% endif %} +
+ {% endfor %} + {% if sort_by is defined %} +
+ {{ sort_by }} +
+
+ {{ sort_order }} +
+ {% endif %} + {% if items_per_page is defined %} +
+ {{ items_per_page }} +
+ {% endif %} + {% if offset is defined %} +
+ {{ offset }} +
+ {% endif %} +
+ {{ button }} +
+ {% if reset_button is defined %} +
+ {{ reset_button }} +
+ {% endif %} +
+
diff --git a/core/modules/views/views.module b/core/modules/views/views.module index f1cb911..f245956 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -161,9 +161,9 @@ function views_theme($existing, $type, $theme, $path) { 'render element' => 'form', ); - $hooks['views_exposed_form'] = $base + array( - 'template' => 'views-exposed-form', - 'pattern' => 'views_exposed_form__', + $hooks['views_view_exposed_form'] = $base + array( + 'template' => 'views-view-exposed-form', + 'pattern' => 'views_view_exposed_form__', 'render element' => 'form', ); @@ -1408,11 +1408,11 @@ function views_form_views_form_submit($form, &$form_state) { * * Be sure that $view and $display are references. */ -function views_exposed_form($form, &$form_state) { +function views_view_exposed_form($form, &$form_state) { // Don't show the form when batch operations are in progress. if ($batch = batch_get() && isset($batch['current_set'])) { return array( - // Set the theme callback to be nothing to avoid errors in template_preprocess_views_exposed_form(). + // Set the theme callback to be nothing to avoid errors in template_preprocess_views_view_exposed_form(). '#theme' => '', ); } @@ -1428,7 +1428,7 @@ function views_exposed_form($form, &$form_state) { // Let form plugins know this is for exposed widgets. $form_state['exposed'] = TRUE; // Check if the form was already created - if ($cache = views_exposed_form_cache($view->storage->id(), $view->current_display)) { + if ($cache = views_view_exposed_form_cache($view->storage->id(), $view->current_display)) { return $cache; } @@ -1466,15 +1466,14 @@ function views_exposed_form($form, &$form_state) { ); $form['#action'] = url($view->display_handler->getUrl()); - $form['#theme'] = views_theme_functions('views_exposed_form', $view, $display); - $form['#id'] = drupal_clean_css_identifier('views_exposed_form-' . check_plain($view->storage->id()) . '-' . check_plain($display['id'])); -// $form['#attributes']['class'] = array('views-exposed-form'); + $form['#theme'] = views_theme_functions('views_view_exposed_form', $view, $display); + $form['#id'] = drupal_clean_css_identifier('views_view_exposed_form-' . check_plain($view->storage->id()) . '-' . check_plain($display['id'])); $exposed_form_plugin = $form_state['exposed_form_plugin']; $exposed_form_plugin->exposed_form_alter($form, $form_state); // Save the form - views_exposed_form_cache($view->storage->id(), $view->current_display, $form); + views_view_exposed_form_cache($view->storage->id(), $view->current_display, $form); return $form; } @@ -1485,7 +1484,7 @@ function views_exposed_form($form, &$form_state) { * Since the exposed form is a GET form, we don't want it to send a wide * variety of information. */ -function views_form_views_exposed_form_alter(&$form, &$form_state) { +function views_form_views_view_exposed_form_alter(&$form, &$form_state) { $form['form_build_id']['#access'] = FALSE; $form['form_token']['#access'] = FALSE; $form['form_id']['#access'] = FALSE; @@ -1494,7 +1493,7 @@ function views_form_views_exposed_form_alter(&$form, &$form_state) { /** * Validate handler for exposed filters */ -function views_exposed_form_validate(&$form, &$form_state) { +function views_view_exposed_form_validate(&$form, &$form_state) { foreach (array('field', 'filter') as $type) { $handlers = &$form_state['view']->$type; foreach ($handlers as $key => $handler) { @@ -1508,7 +1507,7 @@ function views_exposed_form_validate(&$form, &$form_state) { /** * Submit handler for exposed filters */ -function views_exposed_form_submit(&$form, &$form_state) { +function views_view_exposed_form_submit(&$form, &$form_state) { foreach (array('field', 'filter') as $type) { $handlers = &$form_state['view']->$type; foreach ($handlers as $key => $info) { @@ -1541,7 +1540,7 @@ function views_exposed_form_submit(&$form, &$form_state) { * @return * Array. The form structure, if any. Otherwise, return FALSE. */ -function views_exposed_form_cache($views_name, $display_name, $form_output = NULL) { +function views_view_exposed_form_cache($views_name, $display_name, $form_output = NULL) { // When running tests for exposed filters, this cache should // be cleared between each test. $views_exposed = &drupal_static(__FUNCTION__); diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index bb264fa..3594e8f 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -944,7 +944,7 @@ function template_preprocess_views_view_row_rss(&$vars) { * An associative array containing: * - form: A render element representing the form. */ -function template_preprocess_views_exposed_form(&$variables) { +function template_preprocess_views_view_exposed_form(&$variables) { $form = &$variables['form']; // Put all single checkboxes together in the last spot.