? .svn ? 657148-exposed-sort.patch ? LICENSE.txt ? better_exposed_filters.patch ? tests/.svn ? translations/.svn Index: better_exposed_filters.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/better_exposed_filters/better_exposed_filters.js,v retrieving revision 1.9 diff -u -p -r1.9 better_exposed_filters.js --- better_exposed_filters.js 7 Jun 2010 22:56:05 -0000 1.9 +++ better_exposed_filters.js 26 Aug 2010 15:22:12 -0000 @@ -60,5 +60,19 @@ if (Drupal.jsEnabled) { } }); } + + /* + * Add support for Do Not Sort option for exposed sorts (Views 3.x only) + */ + $('.views-exposed-form').parents('form:first').submit(function() { + if ($('.bef-sortorder input[value=0]:checked', this).length) { + // Uncheck/select the sort_by and sort_order elements + $('.bef-sortorder input', this).attr('checked', ''); + $('.bef-sortby input', this).attr('checked', ''); + $('.bef-sortby select', this).remove(); + } + // Allow normal form processing to continue from here + }); + }; } Index: better_exposed_filters.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/better_exposed_filters/better_exposed_filters.module,v retrieving revision 1.14 diff -u -p -r1.14 better_exposed_filters.module --- better_exposed_filters.module 14 Aug 2010 19:21:56 -0000 1.14 +++ better_exposed_filters.module 26 Aug 2010 15:22:12 -0000 @@ -186,6 +186,12 @@ function better_exposed_filters_theme($e return array( 'select_as_checkboxes' => array('function' => 'theme_select_as_checkboxes'), 'select_as_hidden' => array('function' => 'theme_select_as_hidden'), + 'select_as_links' => array('function' => 'theme_select_as_links'), +/* + 'function' => 'theme_select_as_links', + 'arguments' => array('sort_order' => NULL), + ), +*/ ); } @@ -274,6 +280,75 @@ function theme_select_as_checkboxes($ele } /** + * Themes a select element as a series of links + * + * @see theme_select(), http://api.drupal.org/api/function/theme_select/6 + * @param object $element - An associative array containing the properties of the element. + * Properties used: title, value, options, description, extra, multiple, required + * @return HTML string representing the form element. + */ +function theme_select_as_links($element) { + $output = ''; + $selected_options = (array)$element['#post'][$element['#name']]; // the selected keys from #options + $properties = array( + 'title' => $element['#title'], + 'description' => $element['#description'], + 'required' => FALSE, + ); + + foreach ($element['#options'] as $option => $elem) { + // Check for Taxonomy-based filters + if (is_object($elem)) { + list($option, $elem) = each(array_slice($elem->option, 0, 1, TRUE)); + } + + /* + * Check for optgroups. Put subelements in the $element_set array and add a group heading. + * Otherwise, just add the element to the set + */ + $element_set = array(); + if (is_array($elem)) { + $element_set = $elem; + } + else { + $element_set[$option] = $elem; + } + + $links = array(); + foreach ($element_set as $key => $value) { + + // Custom ID for each hidden field based on the