Last active
February 4, 2016 12:40
-
-
Save massiws/60c4c7f473f688ed0847 to your computer and use it in GitHub Desktop.
Drupal: change maxlength and size of description field in default upload widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* The description used as label of the link to the uploaded file has default lentgh=128 and size=60. | |
* With this function inside your custom module you can change these (and other) default options. | |
*/ | |
/** | |
* Implements hook_preprocess_file_widget(). | |
*/ | |
function msw_custom_preprocess_file_widget(&$vars) { | |
if (isset($vars['element']['#file']) && is_object($vars['element']['#file'])) { | |
$vars['element']['description']['#maxlength'] = 600; | |
$vars['element']['description']['#size'] = 120; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment