Longer slogan text in Drupal 7

Estimated reading time of this article: 0 minutes 37 seconds

Do you want a longer slogan in Drupal 7?

E.g. in my case, I'm linking some keywords of my slogan to taxonomy terms. Then the limit of 128 characters is fast too small. Luckily, this can be changed fast and easy in a clean way.

Simply add the following hook in your module:

<?php
/**
 * Increase the length of the slogan.
 * Implements hook_form_FORM_ID_alter.
 */
function YOUR_MODULE_form_system_site_information_settings_alter(&$form, &$form_state, $form_id) {
 
$form['site_information']['site_slogan']['#maxlength'] = 255;
}
?>

This is the clean way in Drupal, and much better than directly hacking the core. If you would have hacked the core, then you would have to repeat your hack each core update.