Closed (fixed)
Project:
Webform
Version:
7.x-3.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Jun 2011 at 20:53 UTC
Updated:
15 Jul 2011 at 23:31 UTC
Jump to comment: Most recent file
I was trying to 'borrow' some themeing code from your date component for use on a form of my own. I tried to do so by setting '#theme' = 'webform_date' on the lement. However this lead me to discover that the file (date.inc) is not loaded when the theme('webform_date', ...) function was called.
Probably no problem in your own code, but for external code it might be. The solution is to add a 'file => '...' entry to each function-based theme hook defined in one of the component includes. Example:
file: components/date.inc
function _webform_theme_date() {
return array(
'webform_date' => array(
'render element' => 'element',
'file' => 'components/date.inc', // add this line everywhere
),
...
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | webform_theme_files-d6.patch | 4.3 KB | quicksketch |
| #3 | 1181728.patch | 4.11 KB | amateescu |
Comments
Comment #1
quicksketchI ran across this the other day too. We definitely should do this for all our components that define theme functions. Right now it's not causing any trouble though (since the component file is always pulled in first anyway, since otherwise it wouldn't have a form element to render in the first place), but for "correctness" it would be a good idea.
Comment #2
fietserwinYou're right. I filed this issue when I had not completely sorted out how to hook into/borrow your code. Now that I have, the problem should not appear anymore.
How to get a webform component element into your own form:
Comment #3
amateescu commentedPatch attached.
Comment #4
quicksketchThanks, I rolled this patch for Drupal 6 to match. Committed your patch to D7 and pushed both to Git.
Comment #5
quicksketchHere's the D6 patch I meant to attach to the last post.