function scald_file_form_scald_atom_add_form_options_alter in Scald File Provider 7
Implements hook_form_FORM_ID_alter().
File
- ./
scald_file.module, line 119 - Scald File is a Scald Atom Provider for Files.
Code
function scald_file_form_scald_atom_add_form_options_alter(&$form, &$form_state, $form_id) {
$scald = $form_state['scald'];
if (isset($scald['type'])) {
$type = $scald['type']->type;
}
else {
$type = $scald['atoms'][0]->type;
}
if ($type !== 'file') {
return;
}
foreach ($form as $key => $data) {
if (strpos($key, 'atom') === 0) {
$index = intval(substr($key, 4));
if (isset($scald['atoms'][$index]->data['scald_thumbnail_default'])) {
$scald_thumbnail_default = $scald['atoms'][$index]->data['scald_thumbnail_default'];
}
else {
$scald_thumbnail_default = TRUE;
}
$form[$key]['scald_thumbnail_default'] = array(
'#type' => 'checkbox',
'#default_value' => $scald_thumbnail_default,
'#title' => t('Automatically generate thumbnail'),
'#description' => t('A thumbnail will be generated automatically, if possible, if the thumbnail field is empty.'),
'#weight' => $form[$key]['scald_thumbnail']['#weight'] + 0.5,
'#tree' => TRUE,
'#parents' => array(
$key,
'scald_thumbnail_default',
),
);
}
}
$form['#attached']['js'][drupal_get_path('module', 'scald_file') . '/scald_file_edit_form.js'] = array(
'type' => 'file',
);
array_unshift($form['#submit'], 'scald_file_default_thumbnail_handler');
}