Could you please advice how to set additional CSS class for the comment block using Drupal hook. I'd like to paint the author and date of the comment with green color if the author of comment is not the author of a node.

Something like

function custom_form_alter(&$form, $form_state, $form_id) {

    if ($author_comment_id !== $author_node_id) {

        $form['#attributes']['class'][] = 'add-class';

The problem is that I don't see the #attributes for comment block via dsm ($form). Maybe I'm using the wrong hook? Is there any different way to achive this?

Could you please help?


I would do it by adding a new template for the block. See Drupal 7 Template (Theme Hook) Suggestions

block--[region|[module|--delta]].tpl.php base template: block.tpl.php Theme hook suggestions are made based on these factors, listed from the most specific template to the least. Drupal will use the most specific template it finds:




|improve this answer|||||

You may use this function template_preprocess_comment


|improve this answer|||||
  • Looks like it's what I need. I'll try. Thanks a lot! – jksport May 26 '15 at 10:38

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