add limit comment length

shenzhuxi - September 9, 2009 - 09:20
Project:Maxlength
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:comment, length, limit
Description

A patch for add limit comment length to maxlength module.

AttachmentSize
maxlength.patch3.77 KB

#1

dereine - September 9, 2009 - 09:39

Cool.

+++ /var/www/sugargoss/sites/all/modules/maxlength/maxlength.module 2009-09-09 17:14:34.000000000 +0800
@@ -33,13 +33,23 @@
-
+  // Editing a Comment text field.
+//  elseif ($form_id['#id'] == 'node-type-form' && $form['post']['op'] != 'Save content type') {
+//    _maxlength_content_type_form_alter($form, $form_state, $form_id);
+//  }

I miss settings for comments. I will test the patch tonight.

This review is powered by Dreditor.

#2

dereine - September 9, 2009 - 11:04
Status:patch (to be ported)» needs work

oh this should be .

#3

nicks - November 9, 2009 - 10:51

Thanks for the patch. It seems to work fine. The only thing I would add is that I had expected the "comment limit length" options in the edit content type page to be in the "comment settings" form, rather than in the "submission form settings" form, which only has details for the title and body. Also, in its current location it sits between the "limit body length" and "minimum number of words" form fields. This is confusing because it makes it look as though the "minimum number of words" field applies to comments rather than the body.

#4

nicks - November 9, 2009 - 11:23

I changed the position of the "comment limit length" option to the comment form. I haven't made a patch before, and I've looked at it and I'm not sure it is correct, so I'll explain here too. The change I made to dereine's version is tiny, inside the foreach of _maxlength_content_type_form_alter(), I added:

<?php
    $parent_form
= ($label == 'comment') ? 'comment' : 'submission';
?>

And I then changed the form variables from:

<?php
    $form
['submission']
?>

to:

<?php
    $form
[$parent_form]
?>

AttachmentSize
maxlength2.patch 6.12 KB
 
 

Drupal is a registered trademark of Dries Buytaert.