function royalslider_form_optionset_edit in RoyalSlider Integration 7
Form builder; Form to edit a given option set.
1 string reference to 'royalslider_form_optionset_edit'
- royalslider_ctools_export_ui_form in plugins/
export_ui/ royalslider_ctools_export_ui.inc - Export UI form
File
- ./
royalslider.admin.inc, line 945 - Admin forms for RoyalSlider.
Code
function royalslider_form_optionset_edit($form, &$form_state) {
if (empty($form_state['optionset'])) {
$optionset = royalslider_optionset_create();
}
else {
$optionset = $form_state['optionset'];
}
// Title
$form['title'] = array(
'#type' => 'textfield',
'#maxlength' => '255',
'#title' => t('Title'),
'#description' => t('A human-readable title for this option set.'),
'#required' => TRUE,
'#default_value' => $optionset->title,
);
// Machine name.
$form['name'] = array(
'#type' => 'machine_name',
'#maxlength' => '255',
'#machine_name' => array(
'source' => array(
'title',
),
'exists' => 'royalslider_optionset_exists',
),
'#required' => TRUE,
'#default_value' => $optionset->name,
);
// Skin.
$skins = array();
foreach (royalslider_skins() as $name => $info) {
$skins[$name] = $info['name'];
}
$form['skin'] = array(
'#type' => 'select',
'#title' => t('Skin'),
'#options' => $skins,
'#default_value' => $optionset->skin,
);
// Show select boxes for the various image styles.
$image_style = image_style_options(FALSE);
$form['image_style'] = array(
'#type' => 'fieldset',
'#title' => t('Image styles'),
'#tree' => TRUE,
);
$form['image_style']['fullscreen'] = array(
'#type' => 'select',
'#title' => t('Full Screen image style'),
'#description' => t('Image style for the full screen images.'),
'#empty_option' => t('None (original image)'),
'#options' => $image_style,
'#default_value' => $optionset->imagestyle_fullscreen,
'#states' => array(
'visible' => array(
'input[name="fullscreen[enabled]"]' => array(
'checked' => TRUE,
),
),
),
);
$form['image_style']['normal'] = array(
'#type' => 'select',
'#title' => t('Normal image style'),
'#description' => t('Image style for the main stage images.'),
'#empty_option' => t('None (original image)'),
'#options' => $image_style,
'#default_value' => $optionset->imagestyle_normal,
);
$form['image_style']['thumbnail'] = array(
'#type' => 'select',
'#title' => t('Thumbnail image style'),
'#description' => t('Image style for the thumbnail images.'),
'#empty_option' => t('None (original image)'),
'#options' => $image_style,
'#default_value' => $optionset->imagestyle_thumbnail,
'#states' => array(
'visible' => array(
'select[name="controlNavigation"]' => array(
'value' => 'thumbnails',
),
),
),
);
// Options Vertical Tab Group table
$form['options'] = array(
'#type' => 'vertical_tabs',
);
$default_options = royalslider_option_elements($optionset->options);
// Add the options to the vertical tabs section
foreach ($default_options as $key => $value) {
$form['options'][] = $value;
}
return $form;
}