function _media_youtube_convert_old_variables in Media: YouTube 6
Convert pre-existing variables to the Media: YouTube variable namespace.
2 calls to _media_youtube_convert_old_variables()
- media_youtube_install in ./
media_youtube.install - Implementation of hook_install().
- media_youtube_update_6002 in ./
media_youtube.install - Catch anyone who missed this on a fresh installation.
File
- ./
media_youtube.install, line 282 - This is Media: YouTube's installation, configuration, and removal file.
Code
function _media_youtube_convert_old_variables() {
$ret = array();
$variables = array(
'emvideo_youtube_api_key' => 'api_key',
'emvideo_youtube_api_secret' => 'api_secret',
'emvideo_youtube_show_related_videos' => 'show_related_videos',
'emvideo_youtube_show_colors' => 'show_colors',
'emvideo_youtube_show_border' => 'show_border',
'emvideo_youtube_colors_color1' => 'colors_color1',
'emvideo_youtube_colors_color2' => 'colors_color2',
'emvideo_youtube_full_screen' => 'full_screen',
'emvideo_youtube_high_quality' => 'high_quality',
'emvideo_youtube_display_info' => 'display_info',
'emvideo_youtube_enablejsapi' => 'enablejsapi',
'emvideo_youtube_use_jw_flv' => 'use_jw_flv',
);
foreach ($variables as $old_variable => $new_variable) {
$new_value = media_youtube_variable_get($new_variable);
$old_value = variable_get($old_variable, $new_value);
// Set the variable to the value of the old version of emfield,
// assuming it hasn't already been overridden, and the old version is not
// the current default.
if ($new_value == media_youtube_variable_default($new_variable) && $new_value != $old_value) {
media_youtube_variable_set($new_variable, $old_value);
}
variable_del($old_variable);
}
$ret[] = array(
'success' => TRUE,
'query' => "Converted pre-existing variables to the Media: YouTube variable namespace.",
);
return $ret;
}