function emvideo_youtube_settings in Embedded Media Field 6
hook emvideo_PROVIDER_settings this should return a subform to be added to the emvideo_settings() admin settings page. note that a form field will already be provided, at $form['PROVIDER'] (such as $form['youtube']) so if you want specific provider settings within that field, you can add the elements to that form field.
File
- contrib/
emvideo/ providers/ youtube.inc, line 53 - This include processes youtube.com media files for use by emfield.module.
Code
function emvideo_youtube_settings() {
$form['emvideo_youtube_show_related_videos'] = array(
'#type' => 'checkbox',
'#title' => t('Show related videos'),
'#default_value' => variable_get('emvideo_youtube_show_related_videos', 0),
'#description' => t('If checked, then when playing a video from YouTube, users may hover over the video to see thumbnails & links to related videos.'),
);
$form['api'] = array(
'#type' => 'fieldset',
'#title' => t('YouTube API'),
'#description' => t('This is not currently required. At some point, you may need to apply for an API Developer Key from the <a href="@youtube" target="_blank">YouTube Developer Profile page</a>. Note that you do not need this key to display YouTube videos or their thumbnails.', array(
'@youtube' => EMVIDEO_YOUTUBE_API_APPLICATION_URL,
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['api']['emvideo_youtube_api_key'] = array(
'#type' => 'textfield',
'#title' => t('YouTube Developer Key'),
'#default_value' => variable_get('emvideo_youtube_api_key', ''),
'#description' => t('Please enter your YouTube Developer Key here.'),
);
$form['colors'] = array(
'#type' => 'fieldset',
'#title' => t('Embedded Video Player Colors'),
'#description' => t('If allowed, these two colors, in hexidecimal form (#RRGGBB), will be used to skin the YouTube player.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['colors']['emvideo_youtube_show_colors'] = array(
'#type' => 'checkbox',
'#title' => t('Override player colors'),
'#default_value' => variable_get('emvideo_youtube_show_colors', FALSE),
);
$form['colors']['emvideo_youtube_show_border'] = array(
'#type' => 'checkbox',
'#title' => t('Display border around player'),
'#default_value' => variable_get('emvideo_youtube_show_border', FALSE),
);
$form['colors']['emvideo_youtube_colors_color1'] = array(
'#type' => 'textfield',
'#title' => t('Color 1'),
'#default_value' => variable_get('emvideo_youtube_colors_color1', EMVIDEO_YOUTUBE_COLOR1_DEFAULT),
);
$form['colors']['emvideo_youtube_colors_color2'] = array(
'#type' => 'textfield',
'#title' => t('Color 2'),
'#default_value' => variable_get('emvideo_youtube_colors_color2', EMVIDEO_YOUTUBE_COLOR2_DEFAULT),
);
$form['player_options'] = array(
'#type' => 'fieldset',
'#title' => t('Embedded video player options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['player_options']['emvideo_youtube_full_screen'] = array(
'#type' => 'checkbox',
'#title' => t('Allow fullscreen'),
'#default_value' => variable_get('emvideo_youtube_full_screen', 1),
'#description' => t('Allow users to view video using the entire computer screen.'),
);
$form['player_options']['emvideo_youtube_high_quality'] = array(
'#type' => 'checkbox',
'#title' => t('Use YouTube high quality content'),
'#default_value' => variable_get('emvideo_youtube_high_quality', FALSE),
'#description' => t("If checked, then a parameter will be set to request high quality content. Note: Not all videos from youtube are available in high quality. Those that aren't will play in normal quality."),
);
$form['player_options']['emvideo_youtube_display_info'] = array(
'#type' => 'checkbox',
'#title' => t('Remove titles and ratings on videos'),
'#default_value' => variable_get('emvideo_youtube_display_info', FALSE),
'#description' => t("If checked, additional info, such as title and rating, will NOT be displayed on the YouTube player."),
);
if (module_exists('colorpicker')) {
$form['colors']['emvideo_youtube_colors_color1']['#type'] = 'colorpicker_textfield';
$form['colors']['emvideo_youtube_colors_color1']['#colorpicker'] = 'colorpicker_1';
$form['colors']['emvideo_youtube_colors_color2']['#type'] = 'colorpicker_textfield';
$form['colors']['emvideo_youtube_colors_color2']['#colorpicker'] = 'colorpicker_2';
$form['colors']['colorpicker_1'] = array(
'#type' => 'colorpicker',
'#title' => t('Color 1 picker'),
'#description' => t('Click in this textfield to start picking your color'),
);
$form['colors']['colorpicker_2'] = array(
'#type' => 'colorpicker',
'#title' => t('Color 2 picker'),
'#description' => t('Click in this textfield to start picking your color'),
);
}
else {
$form['colors']['#description'] .= ' ' . t('The <a href="@colorpicker">Colorpicker module</a>, if active, gives an easy way to select these colors.', array(
'@colorpicker' => 'http://drupal.org/project/colorpicker',
));
}
$form['jwflv'] = array(
'#type' => 'fieldset',
'#title' => t('JW FLV Media Player Options'),
'#collapsible' => TRUE,
'#collapsed' => !($flv_path = emfield_flvmediaplayer_url()),
);
$form['jwflv']['emvideo_youtube_use_jw_flv'] = array(
'#type' => 'checkbox',
'#title' => t('Use JW FLV Media Player'),
'#description' => t('If checked, and the server is properly configured, YouTube videos will be played using the !flvplayer.', array(
'!flvplayer' => l(t('JW FLV Media Player'), 'http://www.longtailvideo.com/players/jw-flv-player/'),
)),
'#default_value' => variable_get('emvideo_youtube_use_jw_flv', FALSE),
);
if (!$flv_path) {
$form['jwflv']['#description'] = t('You must first install the !flvplayer, preferably in your /sites/all/plugins folder.', array(
'!flvplayer' => l(t('JW FLV Media Player'), 'http://www.longtailvideo.com/players/jw-flv-player/'),
));
}
if ($flv_path && !_emvideo_youtube_check_flv_player_setup()) {
$form['jwflv']['#description'] = t('You must have the yt.swf file installed in the same folder as your !flvplayer.', array(
'!flvplayer' => l(t('JW FLV Media Player'), 'http://www.longtailvideo.com/players/jw-flv-player/'),
));
}
$form['jwflv']['#description'] = $form['jwflv']['#description'] ? $form['jwflv']['#description'] : t('!flvplayer is properly configured on your server, so may be used to play YouTube videos if desired.', array(
'!flvplayer' => l(t('JW FLV Media Player'), 'http://www.longtailvideo.com/players/jw-flv-player/'),
));
return $form;
}