Hi!
I'm using the version 7.x-4.x-dev. I tried to copy the template file from user_badges/templates/user_badge.tp.php into my theme, and found that it throws a bunch of Undefined index, variables and similar errors.
I was debugging a bit and found the followings:
The Entity module is enabled, and in it's entity.theme.inc there's a line:
// Add suggestions.
$variables['theme_hook_suggestions'][] = $entity_type;
In this case my template was used as an entity template override instead of a user-badge.tpl.php override, and variables defined in template_preprocess_user_badge() are not passed to the template.
I was able to get rid of that by changing the template file definition in user_badges_theme() from 'user_badge' => ... user-badge.tpl.php to something more specific, like
function user_badges_theme() {
return array(
'user_badges_user_badge' => array(
'render element' => 'elements',
'template' => 'templates/user-badges-user-badge',
),
...
I think a patch would be great for that problem. I'll post mine soon.
Comment | File | Size | Author |
---|---|---|---|
#3 | user_badges-template_suggestion_collition-2411439-3-D7.patch | 1.28 KB | imre.horjan |
Comments
Comment #1
imre.horjanHere's a patch.
Comment #2
imre.horjanComment #3
imre.horjanI forgot to refactor template_preprocess_user_badge() function, here's a fix. Maybe there's a better way of integration to the Entity module, but it works.
Comment #4
shabana.navas CreditAttribution: shabana.navas commentedThanks. Will take a look.
Comment #5
shabana.navas CreditAttribution: shabana.navas commentedThanks, that is the right approach.
Comment #6
shabana.navas CreditAttribution: shabana.navas commentedCommitted.
Comment #9
imre.horjanSome lines are not changed in the 4.x-dev version...
There are still these line in the module file:
These are changed to:
Could you please check that?
Comment #10
imre.horjanAs I can see it's already commited to the repository (commit a1fffe6 - 2015.09.26. 09:16), but the packaged zip and tar.gz versions are one commit behind that at 0125443 - 2015.02.06. 09:13.
Comment #11
quotesBro CreditAttribution: quotesBro commented2015-Feb-26 package is the patched one