function colors_admin_settings in Colors 7
Form constructor for the Colors admin form.
1 string reference to 'colors_admin_settings'
- colors_menu in ./
colors.module - Implements hook_menu().
File
- includes/
colors.admin.inc, line 11 - Color page callbacks for the Colors module.
Code
function colors_admin_settings() {
$form = colors_load_colorpicker();
$default_colors = colors_get_colors('colors_default');
$form['default_color'] = array(
'#type' => 'item',
'#title' => t('Default color'),
'#tree' => TRUE,
'input' => array(
'#title' => t('default color'),
'#type' => 'textfield',
'#attributes' => array(
'class' => array(
'colorpicker-input',
),
),
'#default_value' => $default_colors['background'],
'#size' => 7,
'#maxlength' => 7,
'#title_display' => 'invisible',
),
);
$form['process_order'] = array(
'#tree' => TRUE,
'info' => array(
'#type' => 'item',
'#title' => t('Process order'),
),
'enabled' => array(
'#type' => 'checkbox',
'#title' => t('Change the CSS processing order.'),
'#default_value' => variable_get('colors_process_order_enabled', FALSE),
'#description' => t('Color order is cascading, CSS from modules at the bottom will override the top.'),
),
);
colors_include_api();
$form['modules'] = array(
'#tree' => TRUE,
);
$delta = 0;
foreach (module_invoke_all('colors_info') as $module => $info) {
if (!variable_get("colors_{$module}" . '_enabled', FALSE)) {
continue;
}
$weight = variable_get('colors_weight_' . $module, $delta);
$form['modules'][$module]['#name'] = $info['title'];
$form['modules'][$module]['#weight'] = $weight;
$form['modules'][$module]['weight'] = array(
'#type' => 'textfield',
'#title' => t('Weight for @title', array(
'@title' => $info['title'],
)),
'#title_display' => 'invisible',
'#size' => 4,
'#default_value' => $weight,
'#attributes' => array(
'class' => array(
'colors-weight',
),
),
);
$delta++;
}
uasort($form['modules'], 'element_sort');
$form['order_settings'] = array(
'#type' => 'container',
'#states' => array(
'visible' => array(
'input[name="process_order[enabled]"]' => array(
'checked' => TRUE,
),
),
),
);
$form['actions'] = array(
'#type' => 'actions',
'submit' => array(
'#type' => 'submit',
'#value' => t('Save settings'),
'#submit' => array(
'colors_admin_settings_submit',
),
),
);
return $form;
}