function scald_atom_add_form_options in Scald: Media Management made easy 7
Options form.
1 string reference to 'scald_atom_add_form_options'
- scald_atom_add_page in includes/
scald.pages.inc - Atom add page callback.
File
- includes/
scald.pages.inc, line 269 - This file contains the various callbacks related to Scald defined pages.
Code
function scald_atom_add_form_options($form, &$form_state) {
if (empty($form_state['scald']['atoms'])) {
scald_atom_add_form_add_submit($form, $form_state);
}
$atoms = $form_state['scald']['atoms'];
$actions = scald_actions();
$form['#entity_type'] = 'scald_atom';
foreach ($atoms as $delta => $atom) {
$form['atom' . $delta] = array(
'#prefix' => '<div class="atom-wrapper">',
'#suffix' => '</div>',
'#parents' => array(
'atom' . $delta,
),
);
if (count($atoms) > 1) {
$title = 'atom' . $delta . ' : ' . $atom->title;
$form['atom' . $delta] += array(
'#title' => $title,
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
}
$form['atom' . $delta]['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#required' => TRUE,
'#default_value' => $atom->title,
'#parents' => array(
'atom' . $delta,
'title',
),
'#maxlength' => 255,
'#weight' => -10,
);
$form['language'] = array(
'#type' => 'value',
'#value' => $atom->language,
);
field_attach_form('scald_atom', $atom, $form['atom' . $delta], $form_state, entity_language('scald_atom', $atom));
$instances = field_info_instances('scald_atom', $atom->type);
foreach ($instances as $instance) {
$field_name = $instance['field_name'];
$form['atom' . $delta][$field_name]['#parents'] = array(
'atom' . $delta,
$field_name,
);
}
$options = array();
$options_default = array();
foreach ($actions as $name => $action) {
$options[$name] = $action['title'];
$options_default[$name] = $atom->actions & $action['bitmask'] ? $name : '';
}
$form['atom' . $delta]['scald_actions'] = array(
'#type' => 'checkboxes',
'#title' => t('Openly available actions'),
'#group' => 'additional_settings',
'#options' => $options,
'#default_value' => $options_default,
'#parents' => array(
'atom' . $delta,
'scald_actions',
),
'#access' => user_access('restrict atom access'),
);
}
$form['actions']['submit']['#value'] = t('Save');
return $form;
}