technonaturalist

image link to hive image link to ko-fi

Drupal 7 notes hiding unwanted form elements comment forms

posted on: Friday, 11 February 2011 @ 4:25pm in
tagged

Just so I don’t drive myself completely insane again.

It’s a fairly standard theming problem, you have your Drupal comment form rendering thusly:

Drupal comment form (in WANLN theme)

Your site is set to not allow posting by anonymous users, rendering the “Your name” field superfluous and you think the subject line looks ugly, is unnecessary or you just don’t want users giving their comments subjects for whatever reason.

In Drupal 6, you do it like this. In Drupal 7, it’s easier but harder to find. They’re in the docs, but the docs are a bit of a mess still.

comment-wrapper.tpl.php

<?php  
    hide($content['comment_form']['author']); 
    hide($content['comment_form']['subject']); 
  ?>

I’m either stupid or doing something wrong or both but I cannot for the life of e work out how to hide or unset those stupid formatting guidelines.  So css it is.

style.css (or whatever you call yours)

.filter-wrapper { display: none; }