This is a patch for whengets committed into Drupal Core. I need to be able to alter the output of the facetapi links (more so than can be done with simply overriding theme_facetapi_link_inactive or theme_facetapi_link_active. So, I'm using that core patch to enable items passed to theme_item_list to be renderable arrays. The patch that will follow shortly adjusts the facetapi text link widget to make use of this (so that rather than passing in the output of theme_facetapi_link_inactive, you instead pass that instruction as a render array.
Note: I've also added indexed_value as an attribute on these link render arrays, to enable some powerful theming...
My use case:
I have a facet for a 'color' attribute in some products. I need to be able to render these links as color swatches. Usually I would be able to use hook_block_view_alter to get in and adjust the render arrays in the blocks before they get rendered. However, due to a shortcoming in Drupal core, theme_item_list does not accept render arrays on the data attribute (see above linked issue). With that Drupal core patch applied, and this patch (to follow), we now have full access to the underlaying render array from within hook_block_view_alter(). This allows me to use indexed_value to look up the relevant taxonomy term, look at the value of a field attached to that taxonomy term which has a color swatch jpeg, and then render that jpeg inplace of the standard link!
I wrote a similar patch for OG at. This kind of thing allows for very powerful and flexible render array altering in the theme.
|#10||1367612.9-facetapi-links-render-array.patch||6.35 KB||Jon Pugh|
|#8||1367612.8-facetapi-links-render-array.patch||23.34 KB||Jon Pugh|
|#6||Screen Shot 2011-12-24 at 11.43.58.png||21.55 KB||mrfelton|