When a search result is invoked using .../g2/initial/i, where 'i' is an initial, it would be nice to optionally insert the linked alphabetical pager into the header and/or footer, so that users do not have to go back up the breadcrumb to move to terms with another letter.
This is a very common feature in online glossaries.
I would be glad in the meantime for support on how to achieve that in code (as I'm having to now diverge from the most recent release to meet client requirements concerning UI strings, and to use our custom Definition type).
Many thanks for continued maintenance of this promising module,
Webel
Comment | File | Size | Author |
---|---|---|---|
#8 | g2_contexts-700012-8.patch | 10.8 KB | fgm |
#4 | ppi_g2_initial_page_c_header_hacked_in_code_after_initials_title.png | 69.52 KB | webel |
#3 | ppi_g2_main_page.png | 44.86 KB | webel |
#3 | ppi_g2_initial_page_c_custom_block_ABOVE_home.png | 82.75 KB | webel |
Comments
Comment #1
fgmThe best way is to use the alphabar block in the content region (or content_bottom if your theme has one) and a custom block invoking g2_alphabar() in a custom block in the content-top region if your theme has one.
I do not think this needs to be a standard mechanism since it is quite specific to one site layout and so simple to implement.
Comment #2
webel CreditAttribution: webel commentedthanks, have read, will try.
Comment #3
webel CreditAttribution: webel commentedHi, I've turned my hand to this and would like to present the result when a custom block is used to carry an alphabar, using PHP code input format (as admin) and (amongst other code) the snippet:
I then place that block in the region
content top
(I am using theme adapted from the Zen theme), and I set the option Show on only the listed pages to:Although this does enable users to navigate from the initials search result page to any other initials search via the alphabar links, there is a slight problem with this approach, namely that the region
content top
appears above thebreadcrumb (which shows a link to
home >
). So on the main G2 glossary page (accessed via/g2
) the alphabar and description is below the home link, whereas on the initial result page it is below it.Please compare the 2 attached images.
All in all it took quite a bit of tweaking and fiddling in different places
(and some custom CSS styling to handle display of the same text in different region contexts), and I think there is a compelling case for making this a default feature with easily (centralised) customisable content through the G2 admin page.
I will now have a go at doing it directly in code (i.e. hacking your module) to see whether I can't get a more consistent result than with the block approach.
Comment #4
webel CreditAttribution: webel commentedWell its easy enough to generate an alphabar (along with other eye candy) and insert it after the "initialed" title, by introducing a customised alphabar and returning it within
function _g2_initial($initial)
by including it in$ret
(see attachment).However I don't see how to get that customised alphabar to appear before the initialed title, yet after the home link in the breadcrumb, which is where common sense dictates it belongs:
In the above the "initialed" title is set through
drupal_set_title()
, and I don't see where else there is an opportunity for me to intervene (hack in) my customised alphabar. I'd welcome any further suggestions.In the meantime I'll keep using the custom block approach, however it is definitely not yet the desired result.
thanks,
Webel
Comment #5
fgmWell if you do something on it, let's reset the issue as active otherwise it won't get listed :-)
Comment #6
fgmI've looked at it in more detail, and this really is a theme question: what you need is be able to insert the alphabar in your own theme between the breadcrumb and the main content, and this is off-limits for a module.
So I have added a new feature to G2: a "G2 context". Whenever you are on one of the G2 pages (main page, initial, entries, node page), the page-g2.tpl.php in your theme is enabled if it exists, so you can customize just these pages by serving them a modified page template with the alphabars wrapping the content.
The "context-g2" class is now also enabled on the <body> element on the same pages, whether you use a page-g2 template or not. Zen subthemes and some others recognize this by default, others don't... if you are no longer using a Zen subtheme, you can always add this by implementing yourtheme_preprocess_page to get this variable so your page templates get it.
This is included in today's dev. version.
Comment #7
fgmTo be ported to D7 probably on top of Context instead of natively.
Comment #8
fgmPatch fixes this by providing full Context 7.3 integration
- Ctools plugin api
- Context condition, 3 cases
- Context reaction: enable alternate page--g2 template
- Default G2 context declarations for privileged and unprivileged users
Comment #10
fgmPatch failure is apparently a limitation of qa.drupal.org. Committed to dev branch.
Comment #11
webel CreditAttribution: webel commented@fgm thanks for recent efforts, which I will have the opportunity to employ on future sites; the previous fix/workaround will remain in place unchanged on the previous client site which instigated this thread.