function video_cck_youtube_settings in Embedded Media Field 5
hook video_cck_PROVIDER_settings this should return a subform to be added to the video_cck_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/
video_cck/ providers/ youtube.inc, line 45
Code
function video_cck_youtube_settings() {
$form['youtube']['video_cck_youtube_show_related_videos'] = array(
'#type' => 'checkbox',
'#title' => t('Show related videos'),
'#default_value' => variable_get('video_cck_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.'),
);
$api_desc = module_exists('youtube_api') ? t('Please make sure to enter your YouTube API key here.') : t('You will have access to more advanced features if you install and enable the !youtube_api module.', array(
'!youtube_api' => l(t('YouTube API'), 'http://drupal.org/project/youtube_api'),
));
$form['youtube']['api'] = array(
'#type' => 'fieldset',
'#title' => t('YouTube API'),
'#description' => $api_desc,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
// $form['youtube']['api'] = youtube_api_admin_form();
// $form['youtube']['api'] = array(
// '#type' => 'fieldset',
// '#title' => t('YouTube API'),
// '#description' => t('The API is no longer required. However, there may be future features requiring it (such as the ability to display otherwise private videos). You will first need to apply for an API Developer Key from the !youtube. Note that you do not need this key to display YouTube videos or their thumbnails.', array('!youtube' => l('YouTube Developer Profile page', VIDEO_CCK_YOUTUBE_API_APPLICATION_URL, array('target' => '_blank')))),
// '#collapsible' => TRUE,
// '#collapsed' => TRUE,
// );
// $form['youtube']['api']['video_cck_youtube_api_key'] = array(
// '#type' => 'textfield',
// '#title' => t('YouTube API Key'),
// '#default_value' => variable_get('video_cck_youtube_api_key', ''),
// '#description' => t('Please enter your YouTube Developer Key here.'),
// );
// $form['youtube']['api']['video_cck_youtube_api_secret'] = array(
// '#type' => 'textfield',
// '#title' => t('YouTube API Secret'),
// '#default_value' => variable_get('video_cck_youtube_api_secret', ''),
// '#description' => t('If you have a secret for the YouTube API, enter it here.'),
// );
$form['youtube']['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['youtube']['colors']['video_cck_youtube_show_colors'] = array(
'#type' => 'checkbox',
'#title' => t('Override player colors'),
'#default_value' => variable_get('video_cck_youtube_show_colors', FALSE),
);
$form['youtube']['colors']['video_cck_youtube_show_border'] = array(
'#type' => 'checkbox',
'#title' => t('Display border around player'),
'#default_value' => variable_get('video_cck_youtube_show_border', FALSE),
);
$form['youtube']['colors']['video_cck_youtube_colors_color1'] = array(
'#type' => 'textfield',
'#title' => t('Color 1'),
'#default_value' => variable_get('video_cck_youtube_colors_color1', VIDEO_CCK_YOUTUBE_COLOR1_DEFAULT),
);
$form['youtube']['colors']['video_cck_youtube_colors_color2'] = array(
'#type' => 'textfield',
'#title' => t('Color 2'),
'#default_value' => variable_get('video_cck_youtube_colors_color2', VIDEO_CCK_YOUTUBE_COLOR2_DEFAULT),
);
$form['youtube']['player_options'] = array(
'#type' => 'fieldset',
'#title' => t('Embedded video player options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['youtube']['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['youtube']['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."),
);
if (module_exists('colorpicker')) {
$form['youtube']['colors']['video_cck_youtube_colors_color1']['#type'] = 'colorpicker_textfield';
$form['youtube']['colors']['video_cck_youtube_colors_color1']['#colorpicker'] = 'colorpicker_1';
$form['youtube']['colors']['video_cck_youtube_colors_color2']['#type'] = 'colorpicker_textfield';
$form['youtube']['colors']['video_cck_youtube_colors_color2']['#colorpicker'] = 'colorpicker_2';
$form['youtube']['colors']['colorpicker_1'] = array(
'#type' => 'colorpicker',
'#title' => t('Color 1 picker'),
'#description' => t('Click in this textfield to start picking your color'),
);
$form['youtube']['colors']['colorpicker_2'] = array(
'#type' => 'colorpicker',
'#title' => t('Color 2 picker'),
'#description' => t('Click in this textfield to start picking your color'),
);
}
else {
$form['youtube']['colors']['#description'] .= t(' The !colorpicker, if active, gives an easy way to select these colors.', array(
'!colorpicker' => l(t('Colorpicker module'), 'http://drupal.org/project/colorpicker'),
));
}
return $form;
}