Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello there!
I wonder -as my programming skills are pretty scarce-, how could I override the theme function.
I need to show a webform as a block (using the webform module), but I have to show the entire form there.
Is there a way (maybe as a feature wishlist) to control each individual block content from the admin/blocks section? It would be perfect! and a lot easier :-) Or maybe when you create the block from the node, that could be an option...
Thanks in advance!!!!
Rosamunda
Comments
Comment #1
mfredrickson CreditAttribution: mfredrickson commentedHi rosamunda-
You can override the theme function to do what you want, mostly by using copy and paste.
Here's the current theme function:
All you would have to do is change on line:
to
For the reasons why this would work, see
http://api.drupal.org/api/4.7/function/node_view
You can actually just cut and paste the following function into your template.php and it should work. (leave out the <?php and ?> tags)
I like your suggestion about controlling the the fulltext vs. teaser vs. a set of specific fields (for CCK) types. I'll see what I can do to integrate that. There are some similar requests in the issue queue, and perhaps I can roll them all into a single upgrade.
Good luck and thanks for your interest in this module. Feel free to re-open this issue if you need support.
-Mark
Comment #2
Rosamunda CreditAttribution: Rosamunda commentedGee thanks Mark!!!!!
That was terrific! Works like a charm!!!!!!!
Thanks you VERY VERY much!!!!!!!!
And yeah... I LOVE this module!
Rosamunda
Comment #3
skhatri CreditAttribution: skhatri commentedhow do i do this for a 5.x install?
I have a webform that i'd like to display on certain pages as a block. can't seem to do it.
I do the node_load for the webform node and the contents of the node show up, but not the form fields.
Thanks.
Comment #4
mfredrickson CreditAttribution: mfredrickson commentedIt's basically the same:
I should probably put this in the README, as it is such a common request.
Comment #5
kingandy CreditAttribution: kingandy commentedAs an alternative to changing or overriding the module's functions, the following (5.x) snippet seems to display the whole (form-rendered) node when included in a block:
... where 62 is the ID of the node you want.
I'd welcome comments from a more experienced Drupal developer about how appropriate it is to call node_view flat out like that...
Comment #6
TheoRichel CreditAttribution: TheoRichel commentedI pasted the code in my PHPTemplate and it works wonderful (Drupal 5.2). However I would very much like to limit the height of the block. Now this is supposed to be simple CSS, but I am confused WHERE I should give in the height. Which CSS file, or is it in block.tpl or?
The reason: I show videos on my site and in a block next to the video there is supposed to be a block with a transcript of the video. This block should have a scroll function (which comes when I limit its height and there is excess content) otherwise the viewers would have to scroll down the entire page and the video would disappear.
Many thanks,
Theo Richel
Comment #7
nevets CreditAttribution: nevets commentedThe block will have an id, something like 'block-block-4'. Using that example you could add to style.css (at the end)
Comment #8
najibx CreditAttribution: najibx commentedFor D6, it should this instead.
Comment #9
StevenWill CreditAttribution: StevenWill commentedThis is a great module and thanks for the D6 template code!
Comment #10
KurtRanft CreditAttribution: KurtRanft commentedHi,
I'm quiet new to Drupal and would like to use this.
i'm trying to incorporate this but i'm not achieving.
in which file do i need to set those changes?
Kind regards
Kurt
Comment #11
RJL-dupe CreditAttribution: RJL-dupe commentedIs this module no longer being maintained? I have the same question as the last poster: using the latest V6 version and dev version of this module, I can't figure out how to allow the full node (rather than just the teaser) to be accepted. Thank you.
Comment #12
RJL-dupe CreditAttribution: RJL-dupe commentedComment #13
Daugilas CreditAttribution: Daugilas commentedHi,
With some additional stuff to comment#8 it worked on my project and displayed full node instead of teaser.
Just add this function to your template.php file:
Please provide some feedback if it works on your projects.
Comment #14
osmanHi Daugis,
You can also do this: