Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have a few videos in my site that have really long titles and I noticed that there is a 35 character limit. Is there any specific reason for this limitation? It is pretty trivial to change the textfield to accept unlimited characters.
For anybody that needs this now heres the code.
<?php
// file: emfield/contrib/emvideo/emvideo.module
function emvideo_emfield_widget_extra($form, $form_state, $field, $items, $delta = 0, $module) {
$element = array();
if ($module == 'emvideo') {
// Add a title field, but only if the field is allowed.
// If the title is already being used allow it for editing even if it is disabled.
if ($field['widget']['meta_fields']['title'] || !empty($items[$delta]['title'])) {
$element['title'] = array(
'#type' => 'textfield',
'#title' => t('Video Title'),
'#default_value' => isset($items[$delta]['title']) ? $items[$delta]['title'] : '',
'#size' => 60,
'#maxlength' => 0, // Value changed to 0 from 35
'#description' => t('The title for the video.'),
);
}
// ...... more code
}
?>
Comment | File | Size | Author |
---|---|---|---|
#4 | emfield-title-length-991816-04.patch | 571 bytes | cluke009 |
Comments
Comment #1
cluke009 CreditAttribution: cluke009 commentedLooks like we are limited by the actual database table in this instance and 255 is the most you can do.
Comment #2
agileadamI've found a way to set the maxlength of the emvideo's title field through proper hooks, without touching the contrib module(s).
Comment #3
jpamental CreditAttribution: jpamental commentedJust chiming in that I've had the same issue. I've only just started getting Git access set up but hope to contribute a patch that will set the title length at 255 (don't see any reason why it should be different than what the DB is set to allow).
Cheers,
Jason
Comment #4
cluke009 CreditAttribution: cluke009 commentedDecided to create a patch for this finally it is against the 6-2.x branch. Not sure if the patch naming convention is correct though.