are there plans to make a D7 version of MaxLength?

CommentFileSizeAuthor
#14 maxlength_d7.zip13.49 KBschnitzel
#11 d7port-914048-11.patch26.44 KBschnitzel

Comments

tsvenson’s picture

Would also like to see a Drupal 7 version of this module.

A feature that would be nice to have in it would be to make it possible to set separate values for the summary and normal field for the combo field introduced in D7.

yugongtian’s picture

+

jbucks’s picture

I'd also love to see a Drupal 7 version...

geek-merlin’s picture

:-))

extrarumeno’s picture

Subscribe

Anonymous’s picture

sub

noam.hrz’s picture

I started working on upgrading

geek-merlin’s picture

Title: Drupal 7? » D7 Port of Maxlength

cool!

schnitzel’s picture

cool!
what do you think when it will be finished? Because we need it for a customer in about 2 weeks, so if you want, we could help porting it.

anthonyR’s picture

subscribe

schnitzel’s picture

Status: Active » Needs review
StatusFileSize
new26.44 KB

We needed the module for our customer and so we did it.
Patch with D7 Port is attached.
We added also a check for the Title Module (http://drupal.org/project/title), which allows to convert the Title into a field (which you wan't for field based translation). Because of this, the settings for the title limit in the content type edit form don't work anymore (you can change the settings directly in the title field).
There are some comments and also function names which still contain CCK in it, but it still works all.

Would be cool if you can test :)

Most work done by Marian Ostaci. I added the check for the Title Module and reviewed the code.

Tony Finlay’s picture

Schnitzel, I've tried applying your patch (using netbeans) on the module but it's telling me that it's only partially applied, Drupal still recognises the module as 6.x-2.0-beta2.

Any tips on how to get this sucker working?

Cheers to both the original coder and yourself for the work on this module.

Scratch that, I just changed the .info file in the module to look like below to get it working.

; $Id: maxlength.info,v 1.2.4.1.2.1 2009/04/01 23:52:52 dereine Exp $
name = "Maxlength"
description = "Set a maximum length for body fields."
core = 7.x


; Information added by drupal.org packaging script on 2011-02-16
version = "7.x-2.0-beta2"
core = "7.x"
project = "maxlength"
datestamp = "1297863418"

The only issue now is where do I set the char limit? There seems to be no options anywhere

Cheers again guys

dilari’s picture

I've tried applying the patch but it fails.
Now this could very well be due to the fact that I don't know how to do it.

I've tried

$ git apply --whitespace=fix d7port-914048-11.patch

which gives me

maxlength/d7port-914048-11.patch:44: trailing whitespace.
               $default_value = isset($form[$field][$key][$index]['value']['#def
ault_value']) ? $form[$field][$key][$index]['value']['#default_value'] : (isset(
$form[$field][$key][$index]['#default_value']) ? $form[$field][$key][$index]['#d
efault_value']:'');
maxlength/d7port-914048-11.patch:361: trailing whitespace.
Drupal.behaviors.maxlength ={
maxlength/d7port-914048-11.patch:366: trailing whitespace.
      element = $("#"+ id);
maxlength/d7port-914048-11.patch:367: trailing whitespace.

maxlength/d7port-914048-11.patch:368: trailing whitespace.
      if (element.length) {
warning: squelched 2 whitespace errors
warning: 7 lines add whitespace errors.

Would this be the right way to do it?
Would it be possible to simply post the patched maxlength.inc ?

schnitzel’s picture

StatusFileSize
new13.49 KB

Ok maybe it is easier to give you the full module, check the attachement

@dirtyharry
actually you should be able to select it inside of the field settings, like here:
/admin/structure/types/manage/page/fields/body
(this is the edit page of the body field of contenttype page)

cheers

Tony Finlay’s picture

@Schnitzel

Thanks for that, I checked that location already but there were no options available for maxlength, I'm guessing there was an issue with the module patch. I've now tried that full module attachment and thus far it is working like a charm.

Thanks to everyone for their work, it's very appreciated.

dilari’s picture

thanks will check it out.

dilari’s picture

Works great! thanks

dawehner’s picture

@schnitzel

Do you want to maintain this module?
In general i don't have time to try out the port, so it would be cool if you could do something.

k4v’s picture

I committed Schnitzel's patch. Works for me =). Thanks!

k4v’s picture

Status: Needs review » Fixed

fixed

Tor Arne Thune’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

Any chance of getting a 7.x non-dev release? :)

schnitzel’s picture

Yes!

We at @AmazeeLabs are really busy, but using the maxlength in some Customer Projects. We will review the testing and make some small changes, and then I guess we can go to beta :)

Tor Arne Thune’s picture

The Drupal 7 port is great, but I can't seem to get the JavaScript countdown working for the core field comment_body. I have tried to tick the box for JavaScript using the UI, and programmatically in an installation profile (emulating what the module does):

variable_set('maxlength_comment_body_comment_node_page', '510');
variable_set('maxlength_comment_body_js_comment_node_page', 1);
variable_set('maxlength_comment_body_text_comment_node_page', 'Content limited to !limit characters, remaining: <strong>!remaining</strong>');
$field = field_info_field('comment_body');
$field['settings']['max_length'] = '510';
$field['settings']['maxlength_comment_body_js'] = 1;
$field['settings']['maxlength_comment_body_text'] = 'Content limited to !limit characters, remaining: <strong>!remaining</strong>';
field_update_field($field);

The box for JS stays unticked after I update the comment_body field settings (through the normal UI way, and programmatically in the installation profile), no matter if I tick it and save the settings.

Tor Arne Thune’s picture

By the way, the character form validation for comment_body works great, just as input (510 characters).

BenK’s picture

Keeping track of this

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Jance’s picture

Category: feature » bug
Priority: Normal » Major
Status: Closed (fixed) » Active

I'm also experiencing the issue brought up in post #23.

Seems the choice of "Enable remaining characters countdown for this field" refuses to stay check, anyone have any ideas what's happening here?

dawehner’s picture

Status: Active » Closed (fixed)

In general please create new issues for bugs.

bruno33’s picture

Will be fantastic to have such a module for D7 ;)

schnitzel’s picture

Actually there is a D7 Version already, but it needs some testing before we can put it to stable.

It is the 7.x-3.x-dev which is a port from maxlength_js with an upgrade path from 7.x-2.x to 7.x-3.x