I can't seem to theme a weform block. I thought block--webform-client-block-[delta].tpl.php should work but can't seem to get results.
block--webform.tpl.php is about as specific as I can get. Other than that I guess I could turn of the block title and move it into the form itself and theme the webform itself using webform-form.tpl.php but it would be nice if I could figure this out. Thanks!
Comments
Comment #1
quicksketchLooks like it would be
block--webform--client-block-[nid]in Drupal 7. "webform" is the name of the module and then "client-block-[nid]" is the delta. Each needs to be separated by double-dashes.Comment #2
quicksketchComment #3
PMorris commentedThanks! I still can't seem to get it to work even though I have the node id in there. Must be something about drupal 7 i'm not understanding yet.
Comment #4
PMorris commentedActually now that I think of it it might be something wrong with my theme I'm using (zen) which is still being developed for Drupal 7. Ill try more experiments with core themes.
Comment #6
Fabito commentedHi, I don't understand why but
block--webform--client-block-[nid]not work in my case !?I created a new webform, available as block. The nid is "132", and i have the id :
block-webform-client-block-132in front of my<div>. I cleared my cache...Someone could tell me what's wrong ?
Thanks in advance,
Fabien
edit : I have updated webform 3.12 > 3.13, but not work too.
Comment #7
lancewig commentedThis thread is two years old but I have valuable information to add and in the spirit of Drupal I hope my wasted hour saves somebody else.
You have to look at Drupal theming suggestions to understand more about how to name your templates but it's still frustrating as ever with modules like webform.
This is one of those things where if you know a little you can learn a lot. Check out the template_preprocess_block function on how to 'catch the block data' before it hits the page. In this case Devel is your very best friend. You can use the Devel DSM() function to help spit out the vars in a clean fashion to see what's going on...
If you dig around enough you can find the true "delta" of the block that you are looking for ( ref: screenshot ). Devel helps you see through the "Drupal Magic" and understand what the hell is going on.
So back to our original issue. Like the OP, I pounded my head trying to find the right name for the webform block template. That's where it helps to study the theming suggestions and understand the 3 parts of the template name:
block--<module>--<delta>In simple cases it's easy enough to use your webdev tools to view the HTML of the block and make out the proper name. In my case I saw "#block-webform-client-block-815". That makes me tempted to name my template override suggestion the same way. This is the point where we get really mixed up with dashes, double dashes, deltas and pull out our hair. But alas, it's fairly simple. For me it's
block--webform--client-block-815.tpl.php
It's the double dashes that separate the "block" from the module from the delta.
That's fine and great as in #6 but there's one last Gotcha. You have to clear your cache for the changes to take place.
Comment #8
Vanadu commentedI don't want to clutter the thread but I need to thank lancewig for taking the time to clear this up -- it was very helpful and just what I was looking for. Long live old Drupal threads!
Van