1

I have a pretty frustrating problem going on here. I have been reading the answers over at this question: How to change "add to comment" in comment form?.

But unfortunately neither of the suggested solutions worked for me. I tried with the following code in template.php:

function custom_node_view_alter(&$build) {
  if ($build['#node']->type == 'bar') {  //extra check for content type (optional)
    $build['links']['comment']['#links']['comment-add']['title'] = t('Add new review');
  }
  kpr($build);
  dsm($build['#node']->type == 'bar'); // true
}

I've also tried adding comment-wrapper-<my content type>.tpl.php to sites/all/themes/custom/templates but its not picking up either of these changes.

I've flushed all my caches so many times I'm getting RSI, but it's not showing the change. Am I missing something simple here?

1
  • hey did you get anywhere with this? I am also getting RSI atm! Using the code here in the template.php I just can't get it to register! did you work out if it was because of Omega theme? I am using adaptive theme and I guess it could be a similar reason. cheers – saintslash Mar 13 '13 at 11:56
1

You missed a key ['title'] in the array.

$build['links']['comment']['#links']['comment-add']['title'] = t('Add new review');

Make sure you follow the naming conventions while creating a custom module, or if you are doing it from theme replace the custom from custom_node_view_alter with the theme name (e.g. garland_node_view_alter for garland theme).

You can eliminate the extra check (for a while) of the content type for a while to check if the solution is working.

3
  • Thanks for your answer. Unfortunately this still doesn't seem to be being picked up by Drupal. If you look at my edit in my question you'll see the code I'm using. My theme is called custom. – tomhallam Nov 16 '12 at 12:14
  • I've just tested the solution from the Corporate Clean theme's template.php and it worked for me perfectly! And in the answer to the link in your question I'd tested it in module and it worked then too! I'm not sure what is going wrong here. – AjitS Nov 16 '12 at 12:24
  • It could be due to using the Omega theme as a parent. I'll update this thread if I get any joy. – tomhallam Nov 16 '12 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.