Problem/Motivation
The current filter settings form is confusing, leading multiple users to report alter hooks not working because of a missed duplicate checkbox. There are currently two checkboxes that have to both be checked for the hook to work, and yet they say the exact same thing and the second one is checked by default. Because of the layout of the page, the first one (unchecked by default) is frequently missed.
That second checkbox says "always checked" next to it, which doesn't make any sense in and of itself, but also distracts users away from the actual functional checkbox in the list above. WTF?
Proposed resolution
We should remove the second checkbox in the vertical tab and further have the first checkbox above the tabs use the states API to only show the tab below when the checkbox above is checked. Then, the vertical tab becomes merely an information pane, but I think that's fine, especially if it only shows when it's configured correctly to be meaningful.
Remaining tasks
Usability review and patch needed.
User interface changes
Modification to vertical tabs using states linked to filters checkboxes above.
API changes
None
Original report by johnish
hook_facet_items_alter() never fires. I have cleared cache and rebuilt the registry and the step through debugger still doesn't stop on it.
function veritas_facet_items_alter(&$build, &$settings) {
if ($settings->facet == "my_facet_name") {
$build[1]['#markup'] = t('My Custom Title');
}
if ($settings->facet == "item_details") {
foreach($build as $key => $item) {
$build[$key]["#markup"] = drupal_strtoupper($item["#markup"]);
}
}
}
Comment | File | Size | Author |
---|---|---|---|
#11 | facetapi_bonus-2146297-hook-facet-items-alter-11.patch | 3.06 KB | thePanz |
#6 | Screen Shot 2014-12-04 at 1.02.21 PM.png | 54.37 KB | seanr |
#5 | facet filters.png | 30.67 KB | devd |
Comments
Comment #1
johnish CreditAttribution: johnish commentedI see in filter_rewrite_items.inc that their is a form? I looked around and I can't find a configuration for this module.
Comment #2
seanrMake sure you have checked the box for "Rewrite facet items via callback function" on the facet's filter settings. I missed that as well - the box in the verticl tabs group was checked, but the one in the listing above was not.
Comment #3
bserem CreditAttribution: bserem commenteddisregard this comment
Comment #4
bserem CreditAttribution: bserem commentedComment #5
devd CreditAttribution: devd commentedI am also facing the same issue the following hook never executed.
hook_facet_items_alter().
Comment #6
seanrThere are two checkboxes that have to be checked. It's pretty horrible UI, to be honest. See attached.
Comment #7
devd CreditAttribution: devd commentedThanks Robertson,
It is working fine.
Thanks & Regard
Devendra
Comment #8
seanrUpdated issue to propose a UX task to eliminate confusion around this form.
Comment #9
118218 CreditAttribution: 118218 commentedWhere is the filter settings form located?? I am going crazy trying to find it!
Comment #10
robbertnl CreditAttribution: robbertnl commented@#9 you can find it via SearchIndex ->Facets -> Configure Filters -> tab Rewrite facet items via callback function
Comment #11
thePanz CreditAttribution: thePanz at Liip for FREITAG lab. AG commentedPatch attached, added API documentation and settings form cleaned.
Please review
Comment #13
thePanz CreditAttribution: thePanz at Liip for FREITAG lab. AG commentedLatest patch got committed, will be included in the next 7.x-1.3 module release