If you wish to override the default display of the $content variable in your theme (for example, you're using Contemplate module or just would like to specify which fields get displayed where in a node-type.tpl.php file), there is no "clean" way to print the signup stuff that gets added during hook_nodeapi op view...
For example, I can do:
print theme('location', $node->location);
This will print the location information added to a node that is Location module-enabled. I can also do this with event information with:
print theme('event_nodeapi', $node);
I _cannot_ do this with signup, and it would be lovely if I could.
Comments
Comment #1
webchickThe title gets cut off and is not very descriptive in that state. ;)
Comment #2
dwwsure, sounds good. however, themeing is one of my weakest areas of drupal development, so i'd rather just review/test and commit someone else's patch for this, instead of rolling one myself. hint, hint... ;)
Comment #3
cutesimaus commentedyes it would be lovely if we can theme signups too..
someone out there who have done it?
Comment #4
webchickdww: This is not really a theming issue, per se... it's more a module architecture issue. in hook_nodeapi op 'view' there are > 100 lines of code, the end of which appends the output to $node->body directly rather than shoot it to a theme function or some such for display, which could then be called by external modules. I'm happy to provide a patch, but I need some help going through the logic to determine how much of it is "formatting display" and how much of it is "figuring out what to display where."
Comment #5
dwwright, i just meant that since i don't ever do drupal themeing, i'm not all that conscious of code architecture problems that make themeing difficult. ;)
but yeah, your follow-up makes sense. i'd be happy to try to help you sort out the logic when i have a free chance. probably not in the next few days, but hopefully soon. you can also try to get hunmonk's input. he knows the code, too. ;)
Comment #6
cutesimaus commentedHere is my solution for this..
Note: the solution is soooo hardcoded, any other solutions are welcome.
echo substr($node->body, strpos($node->body,"
body) - strpos($node->body,"
Explanation.
Since the signup form will always be at the bottom of my body, I just grabbed that portion of code and display it in my theme.
I dont have other modules adding their codes after that..
So if you're signup form isnt at the bottom of the body, this wont work.
Comment #7
webchick">
cutesiamus: That will work if the signup form is actually displayed, but not if it's displaying, for example, "Signup has been closed."
Here is a patch from jjeff which throws the output into a node property so you can get at it in the theme.
Comment #8
dwwwithout adding a default theme function that deals with this, won't this patch mean that all signup info for a node will be invisible except on sites that customize their theme to display it? that's not ok with me. i'm happy to make life easier for the themers of the world, but i definitely don't want to *force* people who don't really care about that stuff to *have* to tweak their theme, just to enable the signup module.
if i'm full of BS, please set this back to needs review (or RTBC -- other than this complaint, the code looks fine). ;) as i said before, my grasp of theme-related crap is pretty weak...
thanks,
-derek
Comment #9
webchickdww: no, I didn't change the currrent behaviour which appends the output to node->body, so if people are just doing print $content in their node.tpl.php (which is the default behaviour), nothing will change for them. What this patch does instead is offer the option of grabbing the signup info out of the $node object, for those who want more control over where exactly it appears in their theme.
I don't know that I'd mark it RTBC, would be nice to have at least one other person look at this and make sure it looks sane. :) So just marking it back to code needs review.
Comment #10
dwwoh sorry, webchick, i just misread the patch in my sleep-deprived state yesterday. ;) i see what's going on now.
i'll give this a quick test later, and if all goes well, i'll commit it. i think it does no harm...
should this be in 4.7 and HEAD only, or would this be valid/desired in the 4.6 version, too? (i wish we could make version a multi-select, not a drop-down) ;)
Comment #11
boris mann commented4.7 is fine...I came here looking for just this after swearing a bit at how much stuff is done directly in signup, which means hacking rather than theme over-riding.
And of course, events, locations, and signups ARE always used together :P
Comment #12
dwwafter some light testing, i applied this to HEAD and 4.7.
boris: feel free to create issues (preferably with patches) ;) that address your concerns. i took over signup a few months ago, but have been so overwhelmed with project.module and friends that i haven't been able to give signup its proper lovin'. however, i'm usually very responsive to the issue queue -- so don't give up hope...
thanks,
-derek
Comment #13
(not verified) commented