In some cases customers ask for a long site slogan. On the Site Information page (admin/settings/site-information) you'll notice that the slogan field is limited to a maxlength of 128 characters.
Please refer to the comments of Gekiboy (D6) or Harmj (D7) to achieve this. The method in this post is not recommended:
In order to bypass this, find the following file: root/modules/system/system.module.
On line 173 (or nearby) you'll find the following line:
$type['textfield'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#autocomplete_path' => FALSE, '#process' => array('form_expand_ahah'));Replace the number 128 (which indicates the maximum length) with the desired amount of characters, and save it. Now go back to admin/settings/site-information or refresh the page if you're already on it.
Comments
This is not a good idea as it
This is not a good idea as it affects the default text field size for all text fields and makes a change to your Drupal core which would be overwritten if ever you update to a newer version. Instead it's better to use a hook_form_FORM_ID_alter() in a custom module to make this change. For example, if your module was called site_base, the function would look like this:
not working on a D7 site
I created and installed a module containing the function above, careful to change the function name. I changed the maxlength to 1024 and then cleared cache. but the form still only allows 128 characters. my site is a Drupal7 site. Does that make any difference?
—————————
Christopher Pelham
Director
CRS (Center for Remembering & Sharing)
123 4th Ave, 2nd FL
New York, NY 10003
212-677-8621
www.crsny.org
The Drupal 7 form array is
The Drupal 7 form array is slightly different..
I used:
$form['site_information']['site_slogan']['#maxlength'] = 256;
And that worked for me.
New themer here. Where am I
New themer here. Where am I supposed to put this code? (At least the OP's suggestion was easy...)
Create a custom module
Create a custom module (http://www.slideshare.net/tanoshimi/creating-custom-drupal-modules)
and use it in the hook_form_alter function, like this:
for me (in a drupal 7 site)
for me (in a drupal 7 site) it worked like this:
using modulename instead of themename.
found here: http://scito.ch/content/longer-slogan-text-drupal-7
Drupal 8 Implementation
In Drupal 8 you need to modify it to the following:
MODULENAME.info.yml:
MODULENAME.module:
Cant' get this to work
This looks very straightforward. I created the module with the two files above, installed it, enabled it. But the slogan field is still limited the same as before. I did flush all cache just in case.
Any suggestion on where to look?
Can't even get it to be installed
I scrupulously followed your instructions. When using the compressed .tar.gz file to install the new module, I get the error message:
"Unable to create directory 'temporary://update-extraction-7a97f8d7/.' "
I thus can't even install the custom module - and have not been able to check its effectiveness.
Does anyone have a clue on how to solve this?
Kind regards.
re:Can't even get it to be installed
It sounds like your web server does not support uploading modules that way. Try uploading the folder to the correct directory (
sites/all/modules) via FTP or some other mechanism, then visiting the Modules page again to turn it on. See documentation on installing modules for Drupal 7 or Drupal 8.Hawkeye Tenderwolf
a Senior Developer
at Lullabot
Core issue
Core issue to fix that #2928960: Increase site slogan maxlength to 255 to allow longer slogans