Hi--

I have 5 arguments in my view and I set the title for the view like this:
Products: %1: %2: %3: %4: %4: %5

This scheme works great for me but I've recently discovered that the MAXLENGTH property on the edit-options-title field is set to 128...which leaves me high and dry because the string above contains 220 characters.

Im comfortable building a custom module to change this property...but can't figure out what to call to alter this form (dont want to edit views files!!). Would I do this via hook_form_alter()?

Any hints/tips would be much appreciated ;)

thanks,
pp

Comments

ppmax’s picture

Argh: forgot to enclose the stuff in the title field:
<a href="/products/" rel="nofollow">Products</a>: <a href="/products/%1" rel="nofollow">%1</a>: <a href="/products/%1/%2" rel="nofollow">%2</a>: <a href="/products/%1/%2/%3" rel="nofollow">%3</a>: <a href="/products/%1/%2/%3/%4" rel="nofollow">%4</a>: <a href="/products/%1/%2/%3/%4" rel="nofollow">%4</a>: %5

ppmax’s picture

I've got a module and am using hook_form_alter() to try and change the #maxlength property on the views_ui_config_item_form. The difficult part is finding the proper "array path" to change the #maxlength property. I've tried:

1. $form['edit_options_title']['#maxlength'] = 256;
2. $form['edit_options_title']['options[title]']['#maxlength'] = 256;
3. unset($form['edit_options_title']['options[title]']['#maxlength');

The real problem is if I try and var_dump($form, TRUE) I get an ajax error so I cant see the structure of the form.

Any tips? This is a simple problem with a seemingly simple fix. I'm trying to do it the drupal way and really dont want to edit a views file...

thx
PP

merlinofchaos’s picture

Status: Active » Fixed

Install devel.module and use dsm() -- its use of krumo is much more capable of dealing with Views.

Failing that, print_r($var, 1) is also more capable than var_dump(). var_dump() and var_export() fail due to backreferences.

Hope that's enough to help!

Status: Fixed » Closed (fixed)

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

beauz’s picture

Status: Closed (fixed) » Active

I'm also looking for this array path, have devel installed and am using the dsm() function on the form but can't see the correct part, did the OP find what the correct path was?

dawehner’s picture

Status: Active » Fixed

What about $form['options']['alter']['text']? Not sure whether this is 100% right, but it seems to be logical here.

You can really get this via the dsm, there shouldn't be a problem here.

beauz’s picture

I ended up getting around the empty text maxlength by creating a mini override module with this code:

<?php
function views_emptytext_length_form_alter(&$form, $form_state, $form_id) {
    if($form_id == 'views_ui_config_item_form'){
      $form['options']['empty']['#type'] = 'textarea';
    }
}
?>

This changes it from a textfield to textarea which has no such limit. I found core sets default for textfileds to 128 characters.

Might be worth changing this in views module so no one else has this problem.

Status: Fixed » Closed (fixed)

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