Currently, the ctools wizard trail is rendered completely in advance, with no possibility to e.g. add html markup to the trail's items. There is a theme function, theme_ctools_wizard_trail(), but that merely allows to style the separator string used to concatenate the individual trail items. Especially when using the free trail option, any markup used in the trail title appears check_plain'ed in the output, since it is run through l().
Instead of hard-coding the trail title text or link, ctools should rather use render arrays to allow changing the markup during rendering stage.
Comments
Comment #1
smk-ka commentedPatch using render arrays to allow processing of individual trail items on the theme layer.
Comment #2
smk-ka commentedWorked a little bit more on that one, the wrapping <span>'s have been moved to a real #theme_wrapper function and the full wizard context has been made available to the theme functions. This allows to access any additional information put into $form_info['forms'].
Comment #3
merlinofchaos commentedOkay so I think this is a very good idea.
I am worried, though; anyone in the real world who has already implemented their own theme_ctools_wizard_trail() will be broken. The thing is...I don't know if anyone in the real world has done this. People do surprising things, I find.
I think I need a version of this that will NOT break if someone has already implemented this, which means creating a backward compatible version. :(
Comment #4
merlinofchaos commentedComment #5
mrfelton commented> I am worried, though; anyone in the real world who has already implemented their own theme_ctools_wizard_trail() will be broken. The thing is...I don't know if anyone in the real world has done this.
We have done this, but I would be more than happy to replace it with something more flexible. The current theming abilities of the trail are very limiting, and at the moment we can only resort to regex hacks to get the level of control that we need.
Comment #6
zilverdistel commentedAttached is a simple patch which adds a form_info variable to the theme layer. This way, you have infinite flexibility and the solution is still backwards-compatible.
It is not ideal I'm sure, but it has the advantage of being simple ...
Comment #7
merlinofchaos commentedMoving back to needs review so this doesn't get lost.
Comment #8
damienmckennaHow about also passing in the item divider as a theme argument?
Comment #10
michelleI tested #8 by using it for #1775234: Local tasks on MiniPanels edit pages are confusing and it is working for me.
Comment #11
damienmckennaThis tightens up the code in theme_ctools_wizard_trail().
Comment #12
michellePatch #11 also works fine, again tested with #1775234: Local tasks on MiniPanels edit pages are confusing
Comment #13
damienmckennaJust to be clear, the patch does two things:
Separately they are very small changes, together they give some nice potential for customizing part of the display of CTools wizards.
Comment #14
michelleComment #15
japerryAwesome, thats simple. Fixed.