function scald_youtube_form_scald_atom_add_form_options_alter in Scald YouTube 7
Implements hook_form_FORM_ID_alter().
File
- ./
scald_youtube.module, line 191 - Defines a YouTube provider for Scald.
Code
function scald_youtube_form_scald_atom_add_form_options_alter(&$form, &$form_state, $form_id) {
$scald = $form_state['scald'];
if (isset($scald['type'])) {
$source = $scald['source'];
}
else {
$source = $scald['atoms'][0]->provider;
}
if ($source != 'scald_youtube') {
return;
}
foreach ($form as $key => $data) {
if (strpos($key, 'atom') === 0) {
$index = intval(substr($key, 4));
$scald_youtube_show_related = variable_get('scald_youtube_show_related', TRUE);
if (isset($scald['atoms'][$index]->data['show_related'])) {
$scald_youtube_show_related = $scald['atoms'][$index]->data['show_related'];
}
$form[$key]['scald_youtube_show_related'] = array(
'#type' => 'checkbox',
'#default_value' => $scald_youtube_show_related,
'#title' => t('Show related videos'),
'#description' => t('If checked the related videos will be visible at the end of the video.'),
'#weight' => $form[$key]['scald_thumbnail']['#weight'] + 0.5,
'#tree' => TRUE,
'#parents' => array(
$key,
'scald_youtube_show_related',
),
);
$scald_youtube_autoplay = variable_get('scald_youtube_autoplay', FALSE);
if (isset($scald['atoms'][$index]->data['youtube_autoplay'])) {
$scald_youtube_autoplay = $scald['atoms'][$index]->data['youtube_autoplay'];
}
$form[$key]['scald_youtube_autoplay'] = array(
'#type' => 'checkbox',
'#default_value' => $scald_youtube_autoplay,
'#title' => t('Autoplay the video'),
'#description' => t('If checked, the video will be automatically started.'),
'#weight' => $form[$key]['scald_thumbnail']['#weight'] + 0.7,
'#tree' => TRUE,
'#parents' => array(
$key,
'scald_youtube_autoplay',
),
);
$scald_youtube_mute = FALSE;
if (isset($scald['atoms'][$index]->data['youtube_mute'])) {
$scald_youtube_mute = $scald['atoms'][$index]->data['youtube_mute'];
}
$form[$key]['scald_youtube_mute'] = array(
'#type' => 'checkbox',
'#default_value' => $scald_youtube_mute,
'#title' => t('Mute the video'),
'#description' => t('If checked, the video will be muted.'),
'#weight' => $form[$key]['scald_thumbnail']['#weight'] + 0.8,
'#tree' => TRUE,
'#parents' => array(
$key,
'scald_youtube_mute',
),
);
}
}
array_unshift($form['#submit'], 'scald_youtube_extra_options_save_handler');
}