Drupal alter comment form


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /**
  2. * Implementation of HOOK_theme().
  3. */
  4. function THEMENAME_theme() {
  5. return array(
  6. 'comment_form' => array(
  7. 'arguments' => array('form' => NULL),
  8. ),
  9. );
  10. }
  11.  
  12. // theme the comment form
  13. function THEMENAME_comment_form($form) {
  14. // Make the text-area smaller.
  15. $form['comment_filter']['comment']['#rows'] = 5;
  16. // Change the text-area title
  17. $form['comment_filter']['comment']['#title'] = t('Your message');
  18. // Remove input formats information.
  19. $form['comment_filter']['format'] = NULL;
  20. // Removes homepage field
  21. unset($form['homepage']);
  22. // Removes preview button
  23. unset($form['preview']);
  24. return drupal_render($form);
  25. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.