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.
Since everything other callback is hooked up to the module that defines the component, it would make sense to document that you need to supply the path parameter in the API for this function to make it obvious that you are simply providing a wrapper for third party modules and that you are not automating this too. (Or better define path for the module if file defined when parsing these details - an API change maybe now best left to 8.x branch)
Maybe:
/**
* Module specific instance of hook_theme().
*
* This allows each Webform component to add information into hook_theme().
* If you specify a file to include, you must define the path to the module that this
* file belongs to.
*/
function _webform_theme_component() {
return array(
'webform_grid' => array(
'render element' => 'element',
'file' => 'components/grid.inc',
'path' => drupal_get_path('module', 'webform'),
),
'webform_display_grid' => array(
'render element' => 'element',
'file' => 'components/grid.inc',
'path' => drupal_get_path('module', 'webform'),
),
);
}
Comment | File | Size | Author |
---|---|---|---|
#1 | 1724480-1-document_theme_component_path.patch | 925 bytes | fenstrat |
Comments
Comment #1
fenstratYep, this make sense, I've come across this as well. Committed the attached patch to 7.x-4.x, 6.x-3.x and 7.x-3.x.
Getting webform to auto set a path value based on the defining module is an interesting idea, but it is standard practice to set a path value when setting a file value in theme implementations, so I think this doc clarification will cover this.