In at least one observed case (on my development environment) $theme['webform_form']['template'] isn't set to 'webform-form' but to the full path of the old template. To ensure it's set to the correct value I've fixed by adding the following line to the webform_steps_w3_theme_registry_alter.

$theme['webform_form']['template'] = 'webform-form';

Patch in comments!

Comments

raines37’s picture

raines37’s picture

raines37’s picture

Issue summary: View changes
raines37’s picture

torotil’s picture

StatusFileSize
new932 bytes

It seems that $theme['webform_form']['template'] holds the full path to the template at that time. Does the following patch work for you too?

torotil’s picture

Status: Active » Needs review
jaskaran.nagra’s picture

Hi,
Thanks for putting through an awesome module :)

Patch #2 works for me whereas patch #5 doesn't.

I think for #5
$hook['template'] = $hook['path'] . '/webform-form';
should be
$hook['webform_form']['template'] = $hook['path'] . '/webform-form';

While we are on it, do you think it is a good idea to change the names of the webform3.php and webform4.php files to .inc , drupal uses .inc to avoid php scripts being run from outside.

And is there any way to avoid altering the theme registery?

torotil’s picture

$theme['webform_form']['template'] isn't set to 'webform-form' but to the full path of the old template.

That means that it should be set to the full path of the new template, right? At least that is what happens there wasn't an hook_theme_registry_alter() implementation.

What symptoms do you see when $theme['webform_form']['template'] is set to a wrong value? (What's your actual problem?)

Or with other words. Why should the value of $theme['webform_form']['template'] be just 'webform-form' instead of $new_path . '/webform-form' ?

I think for #5
$hook['template'] = $hook['path'] . '/webform-form';
should be
$hook['webform_form']['template'] = $hook['path'] . '/webform-form';

No that should be fine $hook['template'] == $theme['webform_form']['template'].

While we are on it, do you think it is a good idea to change the names of the webform3.php and webform4.php files to .inc , drupal uses .inc to avoid php scripts being run from outside.

As there is no top-level code (code that isn't inside a function or class) in those files executing those files does exactly nothing. I don't think a php-file should have any other extension than .php.

yareckon’s picture

The problem was that ['theme path'] not ['path'] should be set in the alter hook according to this comment:
https://api.drupal.org/comment/29013#comment-29013

The broken symptom before the patch was indeed a double gluing together of paths:

    Warning: include(../sites/all/modules/campaignion_overriden/webform_steps/webform_steps_w3/templates/profiles/campaignion_starterkit/modules/webform/templates/webform-form.tpl.php): failed to open stream: No such file or directory in theme_render_template() (Zeile 1525 von ../includes/theme.inc).
    Warning: include(): Failed opening '../sites/all/modules/campaignion_overriden/webform_steps/webform_steps_w3/templates/profiles/campaignion_starterkit/modules/webform/templates/webform-form.tpl.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in theme_render_template() (Zeile 1525 von ../includes/theme.inc).

where .../ is my drupal docroot.

Attached is your patch, but setting theme path instead.

torotil’s picture

StatusFileSize
new839 bytes

After re-reading _theme_process_registry() and theme() I think the easiest is to simply set $hook['template'] and leave everything else untouched. I'd opt against setting $hook['theme path'] (which should point to a theme/profile/module directory) as we don't want to replace anything other than the template. $hook['path'] is only useful when it's set during hook_theme().

mmartinov’s picture

#10 works for me, no more PHP warnings in the error log.

torotil’s picture

Status: Needs review » Fixed

Committed to 7.x-2.x.

  • torotil committed b5cb146 on 7.x-2.x
    Issue #2502905 by torotil, Raines37, yareckon: Incorrect value for...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.