function spaces_preset_editor in Spaces 6.3
Same name and namespace in other branches
- 7.3 spaces_ui/export_ui/spaces_presets_export_ui.class.php \spaces_preset_editor()
- 7 spaces_ui/export_ui/spaces_presets_export_ui.class.php \spaces_preset_editor()
Preset editor form.
1 string reference to 'spaces_preset_editor'
- spaces_presets.inc in spaces_ui/
export_ui/ spaces_presets.inc
File
- spaces_ui/
export_ui/ spaces_presets_export_ui.class.php, line 135
Code
function spaces_preset_editor(&$form, &$form_state) {
$preset = $form_state['item'];
$form['info']['#type'] = 'fieldset';
$form['info']['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $preset->title,
'#maxlength' => 64,
);
$form['info']['description'] = array(
'#type' => 'textfield',
'#title' => t('Description'),
'#default_value' => $preset->description,
);
$types = array();
foreach (spaces_types(TRUE) as $type => $info) {
$types[$type] = $info['title'];
}
$form['info']['space_type'] = array(
'#title' => t('Type'),
'#type' => 'select',
'#options' => $types,
'#default_value' => $preset->space_type,
'#disabled' => $form_state['op'] === 'edit',
);
$space = spaces_load($preset->space_type, 0);
$stack = array(
'preset',
);
if ($space && !empty($preset->value)) {
foreach ($preset->value as $controller => $overrides) {
if (!empty($overrides) && is_array($overrides)) {
foreach ($overrides as $key => $value) {
$form['revert'][$controller][$key] = array(
'#type' => 'checkbox',
'#title' => $key,
'#disabled' => FALSE,
'#description' => $space->controllers->{$controller}
->summary($key, $value),
);
}
}
}
if (element_children($form['revert'])) {
$form['revert']['#tree'] = TRUE;
$form['revert']['#theme'] = 'spaces_overrides_form';
$form['revert']['revert'] = array(
'#type' => 'item',
'#title' => t('Remove'),
'#description' => t('Remove the selected overrides from this preset.'),
);
$form['revert']['revert']['revert'] = array(
'#type' => 'submit',
'#value' => t('Remove overrides'),
'#submit' => array(
'spaces_preset_editor_remove_overrides',
),
);
}
}
return $form;
}