If you check "Expose sort order" then the sort criteria and sort order will appear as expected (e.g. radio buttons).

If you don't choose "expose sort order" then you get a default select list for the exposed sort, even if you have told BEF to use radio buttons.

In the BEF settings it says:

Expose sort order
Allow the user to choose the sort order. If sort order is not exposed, the sort criteria settings for each sort will determine its order.

So if I don't expose the sort order (i.e. ascending or descending), it should use what I specify in the sort criteria. But then I get a select list and not the radio buttons I told BEF to use.

It should be possible to expose sort criteria without exposing the sort order. For example, I can let people sort alphabetically (ascending) or date (descending). I do not want to expose the order.

For now I can hide the sort order controls with CSS.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pedro Lozano’s picture

Status: Active » Needs review
FileSize
3.51 KB

I confirm this problem.

You need to expose the sort order for the 'display as' option to work.

Here is a patch.

Status: Needs review » Needs work

The last submitted patch, 1977512-exposed-sort-required.patch, failed testing.

klase’s picture

Priority: Normal » Major

I experienced this same issue when working with the July 6, 2013 version of 7.x-3.x-dev. I applied the patch in #1 above and it now works perfectly. Not sure why the patch didn't pass testing but should definitely be revised and tested again as it seems to solve this (rather serious) issue.

Grayside’s picture

Status: Needs work » Needs review
FileSize
3.51 KB

Appears to work for me. Recreated the patch.

git apply worked fine, patch command did not.

Status: Needs review » Needs work
Grayside’s picture

Status: Needs work » Reviewed & tested by the community

Well, the patch doesn't apply by testbot, but does apply manually. Not sure what's going wrong here, but the patch seems to do the trick. Setting to RTBC to surface it for maintainer feedback.

Sam Moore’s picture

Status: Reviewed & tested by the community » Needs work

Patch 1977512-4-better_exposed_filters-exposed-direction-not-required.patch isn't working here -

patching file better_exposed_filters_exposed_form_plugin.inc
Hunk #1 succeeded at 379 with fuzz 2 (offset -177 lines).
Hunk #2 FAILED at 566.
Hunk #3 FAILED at 684.
Hunk #4 FAILED at 702.

It did fix the issue, but caused an undefined index error:
Notice: Undefined index: #options in form_process_radios()
OMM I reversed the patch and all is well, though the original issue persists.
Respectfully setting to "Needs Work".

J77J’s picture

Issue summary: View changes

I have just come across this same issue, radio buttons selected, sort order not exposed = dropdown list.

as Rob230 above I can hide sort order with CSS, but it would be better if this worked.

Really happy with this module in general though, very useful..

mikeker’s picture

Status: Needs work » Closed (cannot reproduce)

Issue queue cleanup...

As of the current version of BEF, I cannot reproduce the problem in original post. Please feel free to reopen this issue with specific steps to reproduce if you're still seeing this problem.

Thanks.

kiwimind’s picture

Version: 7.x-3.0-beta3 » 7.x-3.2
Status: Closed (cannot reproduce) » Needs work

This issue still exists on version 7.x-3.2, as per the original post.

Unless "Expose sort order" is checked, the sort options are output as a dropdown when the "Radio buttons" display is selected.

Only when "Expose sort order" is checked will they display as radio buttons.

I've just quickly tested the -dev version and the issue seems to be there too.

Thanks.

kiwimind’s picture

Status: Needs work » Needs review
FileSize
3.58 KB

Attempt at a re-roll of #4 which seems to apply fine and work as expected.

Status: Needs review » Needs work

The last submitted patch, 11: 1977512-11-better_exposed_filters-expose-sort-order.patch, failed testing.

kiwimind’s picture

Whoops, sorry, sorted out path issue.

kiwimind’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 13: 1977512-12-better_exposed_filters-expose-sort-order.patch, failed testing.

mikeker’s picture

Title: Expose sort order option not working correctly » Expose sort does not render radio buttons when sort order is not exposed
Priority: Major » Normal

Not sure what I was doing in #9, but i can repro this bug. However, it's not major as it's limited to a small subset of BEF functionality and there is no data loss.

Regardless, there are a few issues here:

  1. BEF is allowing to be set some options that should not be available in the current context: eg: Combined sort is available even if the sort order is not exposed.
  2. When sort order is not exposed, valid BEF options (such as radio buttons) are not rendering.

I'd like to focus this issue on #2 and will open a new issue for #1. Changing the title of this issue to better reflect that. From #13:

+++ b/better_exposed_filters_exposed_form_plugin.inc
@@ -766,7 +766,7 @@ dateFormat: "dd-mm-yy"
       // Check for combined sort_by and sort_order.
-      if ($settings['sort']['advanced']['combine']) {
+      if ($settings['sort']['advanced']['combine'] && !empty($form['sort_order'])) {

Cannot combine sort by and sort order if sort order is not exposed.

mikeker’s picture

valross.nu’s picture

I can confirm this issue still exists. Radio buttons only render when sort order is exposed.

Drupal core 7.39
Views 7.x-3.11
Better Exposed Filters 7.x-3.2

vood002’s picture

Although this shouldn't be necessary, I was able to workaround easily enough with hook_form_alter, doing something like this:

<?php
        $form['sort_by']['#type'] = 'radios';
        $form['sort_by']['#default_value'] = 'created';
?>
Neslee Canil Pinto’s picture

Status: Needs work » Closed (won't fix)

Hi, there will be no more future development for 7.x branch. If you see this issue in 8.x, feel free to file an issue. Closing this as Closed(wont fix).