For some reason we have ended up with rather duplicate functionality between this alter hook:

        // Allow other modules to add or remove sorts.
        drupal_alter('apachesolr_sort_links', $sort_links);

and the methods to add and remove sorts via the query object:

  $query->set_available_sort('comment_count', array('title' => t('Most comments'), 'default' => 'desc'));

  $query->remove_available_sort('sort_name');

Should we just remove the alter hook in 7.x? Is there a use case for having it in addition?

CommentFileSizeAuthor
#7 1053126-addon.patch444 bytesnick_vh
#6 1053126.patch1.07 KBnick_vh
#2 1053126-2.patch1.01 KBjpmckinney

Comments

pwolanin’s picture

Title: Remove in 7.x? » Remove duplicate sort hooks in 7.x?
jpmckinney’s picture

Status: Active » Needs review
StatusFileSize
new1.01 KB

Removes alter hook.

pwolanin’s picture

Hmm, I'm remembering/wondering if that's useful for e.g. re-ordering the sort links, etc?

jpmckinney’s picture

Hmm, true - there is no way to do that using the $query object. But can't reordering happen at the theme layer with theme('apachesolr_sort_list')?

nick_vh’s picture

Status: Needs review » Reviewed & tested by the community

Sorts now can be re-arranged by using this
#1324842: Add setAvailableSorts to the api
Marking it as reviewed and tested :)

nick_vh’s picture

StatusFileSize
new1.07 KB

Rerolled patch

nick_vh’s picture

StatusFileSize
new444 bytes

Removed an additional line

nick_vh’s picture

Status: Reviewed & tested by the community » Fixed

Both have been committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.