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.
Original reply.tpl.php does not print submitted variable. So I have to add reply.tpl.php to site's current theme.
When I add reply.tpl.php to site's current theme, the preprocess_reply function in this theme does not called at all. So I should override preprocess_reply in theme. If I override preprocess function in my theme reply links would not be displayed on node page.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2403805-5.patch | 483 bytes | hitfactory |
#1 | 2403805-1.patch | 807 bytes | idebr |
Comments
Comment #1
idebr CreditAttribution: idebr commentedThe preprocess function for the reply hook get overriddens by the entity preprocess functions when the reply.tpl.php is copied to another directory. Attached patch adds the preprocess function when this happens. I'll have a look if this behaviour can be prevented instead of overridden, but it will fix the issue you are experiencing.
Comment #2
Paul B CreditAttribution: Paul B commentedThis bug was fixed before in #1994298: Overriding reply.tpl.php causes fatal error with lastest version of EnityAPI by replacing template_preprocess_reply() with reply_preprocess_entity().
In #2351317: reply.tpl.php is included but never invoked reply_preprocess_entity() was replaced with reply_preprocess_reply().
It appears that template_preprocess_reply() and reply_preprocess_reply() are not called when you override the template,
but reply_preprocess_entity() is not called when you don't override the template. This seems to be related to #1462772: template suggestions are not working if no custom template is defined.
Comment #3
Paul B CreditAttribution: Paul B commentedComment #4
durum CreditAttribution: durum commentedPatch doesn't force the
mytheme_preprocess_reply()
normymodule_preprocess_reply()
functions being hit with the presence of reply.tpl.php but without the patchreply_preprocess_reply()
is not hit.Comment #5
hitfactory CreditAttribution: hitfactory commentedThis workaround outlined by heylookalive on #1462772: template suggestions are not working if no custom template is defined ensures module and theme preprocess hooks are called. Patch with same approach attached.
Comment #6
Paul B CreditAttribution: Paul B commentedComment #7
vyasamit2007 CreditAttribution: vyasamit2007 commentedPatch #5 resolves the issue.
Comment #8
durum CreditAttribution: durum commentedConfirming
mytheme_preprocess_reply()
is hit with the patch andreply.tpl.php
inside theme directory is used.But
$variables['user']
is coming as anonymous user which may be related to the issue Author information wrongComment #9
B Boy Breaker CreditAttribution: B Boy Breaker commented#5 didn't work but #1 works good
thank you
Comment #10
glynster CreditAttribution: glynster commented#1 works a treat +1 RTBC!
Comment #11
alex.skrypnykJust to be clear: you have to apply both #1 and #5 patches to make it all work as they tackle different parts of this issue.
Also, the issue in #5 is due to the bug in EntityAPI module (https://www.drupal.org/node/1462772).
Comment #12
alex.skrypnykIf used with Bootstrap theme, there is another problem going on (https://www.drupal.org/node/2849352) and #5 is not enough.
Your theme would have to implement hook_theme_registry_alter() again and unset 'base hook' value for 'reply' entity again (same as what #5 does).