The alphabar on my main g2 page is being shown twice consecutively - I'm using Drupal 4.7 beta 4, and this is a site in development. I've done a few minor mods to the module, mainly just with what display text is shown; I can't see that anything I've done would cause this, so I'm reporting it as a bug. I'm happy to demonstrate the error at my site if required.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | g2.module.patch | 4.22 KB | fgm |
Comments
Comment #1
fgmActually, it's a feature: unless you adapt your theme specifically for G2, the default theme emits two alphabars to wrap the contents of the custom non-zero page you define as being the main G2 page (see admin/settings/g2: "Node used for the main page of G2 on this site" textfield).
You can overload this by creating a
<your_theme>_alphabar()function in<your_theme>.theme.Note that your custom main G2 page can be a PHP page if you so choose, allowing you to have dynamic content, for instance a dynamically built list of taxonomy terms to link to sections of your glossary.
Comment #2
fgmActually, I made an error in my previous answer: you have to write
<mytheme>.theme/<mytheme>_g2_main()/function riff_g2_main(), not<mytheme>_alphabar().Here is a sample
<mytheme>_g2_main():The commented-out code is the default formatting.
As it is not a bug, I'm closing this issue: if you (or some other reader) thinks the default themeing should be different, please contact me.
Comment #3
robert castelo commentedI'd classify this as a bug, since if no node has been defined the alphabar will be displayed twice as one continuos text.
Here's some code that avoids the problem all together:
In function theme_g2_main()
Change:
To:
Note that isset($node) is TRUE even when $node is returned set to bool(FALSE).
Comment #4
robert castelo commentedI'd actualy advice you to move all the code from theme_g2_main() in to function _g2_main().
Use theme_g2_main() just to wrap some markup around the output. Ideally have as little logic as possible in theme functions.
Comment #5
fgmRobert,
I agree with your first suggestion, but the very fact of agreeing with the rationale of your second suggestion forces me to disagree with the suggestion itself.
Here is a patch against the latest CVS version. It includes comments regarding the second suggestion
It incorporates various other changes created in the meantime and not yet stabilized, though
Comment #6
robert castelo commentedThanks, that looks excellent.
By the way, if you pass the output from g2_main() through theme_g2_main() you could wrap the whole node like this:
That would allow themes to style any part of the node using CSS inheritance, e.g. in CSS:
Comment #7
fgmOr, Robert confirmed off-site that this was a different issue that will be processed separately, so I'm committing the patch.
Comment #8
fgmVersion 1.15.2.7 now displays by default a single alphabar if the selected main page is empty, as is the case if it is the default (node 0).
Comment #9
(not verified) commented