Continuing my support issue from here: #891974: Change display of exposed filters to links - pager, sort
In my opinion the best placement for this feature will be in this module.

This patch add new select option 'Links' in 'Display exposed sort options as:' dropdown.
This is the patch against the version with patch applied from: #657148: Add support for Exposed Sort #3

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kenorb’s picture

Status: Active » Needs review
kenorb’s picture

FileSize
23.13 KB

Added 'Links' display as well for pager.
Please test it.

After testing it's good to move all theme files to separate better_exposed_filters.theme.inc file.

mikeker’s picture

kenorb, Thanks for the patch and your work on this issue!

Agreed, the theme function are getting large enough that they warrant their own theme.inc file. I'll refactor that the next time I do a major checkin.

I haven't had a chance to give you patch a try but hope to in the near future. In the meantime, any feedback from the community is appreciated!

Thanks.

dgastudio’s picture

subscribe

mahnster’s picture

I applied this patch, the second one in #2, but don't see a "link" option in the list of display options. Do I need to apply the patch in the original post as well? Or does the second patch have it with the 'added' feature?

mahnster’s picture

Well, I see that only one of the two patches can be applied, so I tried one, went back to original code, then the other, but even if I empty the cache and return to the Views edit screen and edit the filter to show this for, still nothing in the drop-down for "Links", just Radio/Checkboxes. Am I missing something?

kenorb’s picture

Make sure that you have: Exposed form style: Better Exposed Filters
Your pager or sort filter is exposed.
And in 'Exposed form style' settings select from 'DISPLAY EXPOSED SORT OPTIONS AS:' and 'DISPLAY EXPOSED PAGER OPTIONS AS:' dropdowns: 'Links' option.
If you don't see it, clear the cache or make sure that patch has been applied correctly.

chuckbar77’s picture

+1 subscribing

kenorb’s picture

Updated.
FIX: Link shouldn't be generated when sorting or pager is the same as current.

kenorb’s picture

Small fix with url link encoding, when changing from one sorting to another one.

Known issues:
Doesn't work when AJAX Pager is enabled. Link path have to be updated.

dgastudio’s picture

it work with views 2.6?

kenorb’s picture

Tested with Views 3.x.
If Better Exposed Filters module works with 2.x, this patch should work as well.

dgastudio’s picture

kenorb, i have applied your patch without any problem to last dev version of BEF.

but in views 2.6 (last stable) links doesnt appear.

P.D. Sorry for my english.

kenorb’s picture

Unfortunatelly Views 2.x doesn't support exposed 'Items per page'.
See: #324092: Expose: Items per page and Offset #60

dgastudio’s picture

ok, thank u!

YK85’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for this awesome work!

YK85’s picture

Hi kenorb,

I was wondering if there has been any further development here or if patch at #10 (Oct 7th) is the final version?

Thanks!

AaronBauman’s picture

+1
subscribe

ppcc’s picture

The patch at #10 totally fails on the latest dev.

ppcc’s picture

Status: Reviewed & tested by the community » Active

What;s the best way to achieve this in views 3?

kenorb’s picture

Status: Active » Needs work
kenorb’s picture

I see that it's already partly implemented, theme callbacks:
http://drupal.org/cvs?commit=459396
http://drupalcode.org/viewvc/drupal/contributions/modules/better_exposed...

  // NYI:
260	 	     'sort_select_as_links' => array('function' => 'theme_sort_select_as_links',
261	 	                                     'file' => 'better_exposed_filters.theme'),

Source is changed a lot, so it's difficult to convert this patch.

kenorb’s picture

In attachment latest patch against:

; Information added by drupal.org packaging script on 2010-05-25
version = "6.x-1.0"
core = "6.x"
project = "better_exposed_filters"
datestamp = "1274810407"

I don't remember if I did some new changes from patch #10.

mikeker’s picture

kenorb, Thanks for your continued work on this. I promise to get this reviewed and committed before more checkins break the patch again. I've only been able to work on this project in fits and starts recently...

kenorb’s picture

There is as well special property in view handler, when it's TRUE, sort could be clickable.

i.e.

 // Tid handler and filter
  $data['apachesolr_node']['tid']['field'] = array(
    'numeric' => TRUE,
    'handler' => 'lib_views_apachesolr_views_handler_field_tid',
    'click sortable' => TRUE,
  }
mikeker’s picture

I've checked in some preliminary code for supporting links as an option for BEF for Views 3.x. There is nothing preventing this from working for Views 2.x, it's just I haven't had the time to work with that yet.

Some (perhaps fairly large) caveats:

  • Links do not currently function well with non-linked filters. Eg: click a link or two, then tick a checkbox and click Apply and the link-based selections are lost
  • Not tested at all with AJAX-based views -- feedback welcome
  • I've generalized the initial sort_as_links, etc. to be just theme_select_as_links which means we can use them for filter, sort, pagers, and (hopefully) work them into "nested" displays for hierarchical taxonomy filters.
  • URI query string rewriting was rewritten

kenorb, thank you for your work (and patience) on this issue. Please give the current -dev release a try (in a test environment -- these changes are NOT ready for the real world yet) and let me know if things still work for your use case. Especially in light of the query string rewriting stuff... Thanks.

I really want to get this working with AJAX-based views so that a user could click on links at get "instant filter" style results. Basically another way to eliminate the Apply button. Anyhow that's my next push but with the holidays coming up time is scarce.

kenorb’s picture

Status: Needs work » Needs review

Works fine.

YK85’s picture

Status: Needs review » Reviewed & tested by the community

RTBC

soraver’s picture

Category: feature » support

hi,
i tried the last patch with the bef you mensioned and it didnt work for me.
it didnt show me "Links" on the drop down menu where it mensions ratio buttons etc.

i tried it with this:
version = "6.x-3.0-alpha3"
core = "6.x"
project = "views"
datestamp = "1270684211"

i followed the instructions on #7

but i dont see 'DISPLAY EXPOSED SORT OPTIONS AS:' and 'DISPLAY EXPOSED PAGER OPTIONS AS:'
i see 'Display "Taxonomy: Term" exposed filter as:' on the Exposed form/Exposed form style/options
and the drop down only has "Default select list", "hidden" and "checkboxes/ratio buttons"

i have cleared cache many times and i am sure that the patch has been applied correctly.

do you have any ideas? any place i should look at?

mikeker’s picture

Status: Reviewed & tested by the community » Closed (fixed)

As per #26, this has been committed. Grab the latest -dev release instead of using kenorb's patch. There were several important changes between the patch and what was checked in. Also, make sure you've got at least one exposed sort in order to see those options. I just verified this is working with BEF 6.x-1.x-dev and Views 6.x-3.0-alpha3.

(Note: you will need to clear your caches after updating the code as this adds a couple new theme functions).

I'm marking has fixed (which I should've done at #26...) and closing. If you still have problems after using the -dev release, feel free to reopen and attach or paste an export of the view in question.

kenorb’s picture

Category: support » feature
Status: Closed (fixed) » Reviewed & tested by the community
kenorb’s picture

Status: Reviewed & tested by the community » Closed (fixed)
LetUsBePrecise’s picture

This works great. Just wondering if we can have link feature available for filter as well, like we have for sort at the moment.

mikeker’s picture

Links are an option for filters in the 7.x branch. Not sure if that'll make it into the 6.x branch or not. Right now I'm trying to get a 6.x release out the door, which means new functionality takes a back seat to bug fixes.

LetUsBePrecise’s picture

May be once 6.x release is out and bugs are fixed, this link functionality for filter gets implemented in 6.x. Not sure if members like me are ready for 7.x branch for even next 2-3 years. This is really good module to use. Thanks for your contribution to drupal community.

mikeker’s picture

I've opened a new issue for the filters-as-links functionality: #1159232: Backport filters-as-links functionality from 7.x.

Thanks.

pitxels’s picture

I was wondering, if this solution was made with jquery and if a jquery.get() could be used so the links can work with the ajax option...

AlexanderPop’s picture

dgastudio’s picture

Alexander, a u sure that with views hacks we can show exposed filters as links?

check : #1118164: Can an exposed filter be rendered as a list of links?

threadsniper’s picture

Trying to achieve the same thing on D7. Filter displays as links, but sort does not...