function delta_layout_edit in Delta 7.2
Form callback for creating and editing theme settings templates
_state
Parameters
$form:
1 string reference to 'delta_layout_edit'
- delta_ui_menu in ./
delta_ui.module - Implementation of hook_menu().
File
- ./
delta_ui.admin.inc, line 148 - Delta UI functionality
Code
function delta_layout_edit($form, &$form_state, $layout = FALSE) {
if ($layout) {
//drupal_set_message('we are editing <strong>' . $layout . '</strong>.');
$data = delta_get_layout_data($layout);
}
$form = array();
if (isset($form_state['build_info']['args'][0])) {
drupal_set_title(t('Edit Delta Layout'));
$edit = $form_state['build_info']['args'][0];
}
else {
drupal_set_title(t('Add Delta Layout'));
}
$form['delta'] = array(
'#type' => 'vertical_tabs',
'#weight' => -100,
'#prefix' => '',
'#suffix' => '<div id="theme_settings_replace"></div>',
);
$form['delta']['settings'] = array(
'#type' => 'fieldset',
'#title' => t('Layout Settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['delta']['settings']['tid'] = array(
'#type' => 'value',
'#value' => isset($data['tid']) ? $data['tid'] : NULL,
);
$form['delta']['settings']['title'] = array(
'#type' => 'textfield',
'#title' => t('Name of Layout'),
'#required' => TRUE,
'#size' => 32,
'#default_value' => isset($data['name']) ? $data['name'] : NULL,
);
$form['delta']['settings']['name'] = array(
'#type' => 'machine_name',
'#title' => t('System name'),
'#default_value' => isset($data['system_name']) ? $data['system_name'] : NULL,
'#maxlength' => 64,
'#description' => t('A unique name to construct the URL for the template. It must only contain lowercase letters, numbers and hyphens.'),
'#machine_name' => array(
'exists' => 'delta_layout_name_exists',
'source' => array(
'delta',
'settings',
'title',
),
'label' => t('System Name'),
'replace_pattern' => '[^a-z0-9-]+',
'replace' => '-',
),
'#disabled' => isset($data['tid']) ? TRUE : FALSE,
);
$allowed_themes = variable_get('delta_themes', array());
$themes = delta_get_themes_form_array($allowed_themes);
$form['delta']['settings']['theme'] = array(
'#type' => 'select',
'#title' => t('Theme'),
'#default_value' => isset($data['theme']) ? $data['theme'] : NULL,
'#options' => array(
'none' => 'Select Theme',
) + $themes,
/*
'#ajax' => array(
'callback' => 'delta_load_theme_settings_callback',
'wrapper' => 'theme_settings_replace',
'method' => 'replace',
'effect' => 'fade',
), */
// disable changing the theme this is associated with after creation
// you would need to create a new one to do something like that. :P
'#disabled' => isset($data['tid']) ? TRUE : FALSE,
);
/*
$form['delta']['overrides'] = array(
'#type' => 'fieldset',
'#title' => t('Theme Settings Overrides'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
if (isset($data['theme'])) {
$form['delta']['overrides']['custom'] = delta_load_theme_settings_callback($form, $form_state, $data['theme']);
}
*/
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
// Only custom theme setting templates may be deleted.
/*
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
//'#access' => isset($edit) ? TRUE : FALSE,
);
*/
//krumo($form);
return $form;
}