Commit 2ba854ee authored by guschilds's avatar guschilds

Issue #2229871 by ZikPhil, alberto56, guschilds: Fixed building of widget form...

Issue #2229871 by ZikPhil, alberto56, guschilds: Fixed building of widget form to allow for proper i18n_field translations.
parent 111554e6
......@@ -469,31 +469,31 @@ function youtube_field_widget_info() {
function youtube_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$value = isset($items[$delta]['input']) ? $items[$delta]['input'] : '';
$element += array(
$element['input'] = $element + array(
'#type' => 'textfield',
'#default_value' => $value,
'#size' => 60,
'#maxlength' => 1024,
'#element_validate' => array('youtube_input_validate'),
//'#value_callback' => 'youtube_widget_value',
);
// Add our own description if one is not provided by the UI.
if ($element['#description'] == '') {
$element['#description'] = t('Enter the YouTube URL. Valid URL formats
include: http://www.youtube.com/watch?v=1SqBdS0XkV4 and
$element['input']['#description'] = t('Enter the YouTube URL. Valid URL
formats include: http://www.youtube.com/watch?v=1SqBdS0XkV4 and
http://youtu.be/1SqBdS0XkV4');
}
$return = array('input' => $element);
if (isset($items[$delta]['video_id'])) {
$video_id_element = array(
'#markup' => '<div class="youtube-video-id">' . t('YouTube video ID: ') . $items[$delta]['video_id'] . '</div>',
$element['video_id'] = array(
'#prefix' => '<div class="youtube-video-id">',
'#markup' => t('YouTube video ID: !video_id', array('!video_id' => $items[$delta]['video_id'])),
'#suffix' => '</div>',
'#weight' => 1,
);
$return['video_id'] = $video_id_element;
}
return $return;
return $element;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment