public function sweaver_plugin_styles::sweaver_menu_callback in Sweaver 6
Same name and namespace in other branches
- 7 plugins/sweaver_plugin_styles/sweaver_plugin_styles.inc \sweaver_plugin_styles::sweaver_menu_callback()
Menu callback
Overrides sweaver_plugin::sweaver_menu_callback
File
- plugins/
sweaver_plugin_styles/ sweaver_plugin_styles.inc, line 508 - Styles plugin.
Class
Code
public function sweaver_menu_callback() {
$form = array();
// Settings.
$form['sweaver_styles_delete_tab'] = array(
'#type' => 'checkbox',
'#title' => t('Show delete tab'),
'#description' => t('Show the delete tab in the frontend editor.'),
'#default_value' => variable_get('sweaver_styles_delete_tab', FALSE),
);
$form['sweaver_styles_autosave'] = array(
'#title' => t('Autosave'),
'#type' => 'select',
'#options' => array(
0 => t('Never'),
5 => t('Every 5 seconds'),
10 => t('Every 10 seconds'),
15 => t('Every 15 seconds'),
30 => t('Every 30 seconds'),
45 => t('Every 45 seconds'),
60 => t('Every minute'),
120 => t('Every two minutes'),
),
'#default_value' => variable_get('sweaver_styles_autosave', 0),
'#description' => t('Check for changes on your style and custom CSS every x seconds. If a change has been identified, sweaver will save those settings in a temporary cache table with AJAX. So leaving a page - or even worse, a browser crash - will make sure you keep your current configuration.'),
);
$form = system_settings_form($form);
// Styles list.
$rows = array();
$result = db_query("SELECT ssd.*, ss.active FROM {sweaver_style_draft} ssd LEFT JOIN {sweaver_style} ss on ss.style_id = ssd.style_id ORDER BY ssd.style ASC, ssd.theme ASC, ss.active DESC");
while ($style = db_fetch_object($result)) {
$row = array();
$row[] = check_plain($style->style);
$row[] = str_replace('_', ' ', check_plain($style->theme));
switch ($style->active) {
case 0:
$row[] = t('Inactive');
break;
case 1:
$row[] = t('Active');
break;
}
$operations = '';
if (!$style->active) {
$operations .= l(t('Enable'), 'admin/settings/sweaver/styles/enable/' . $style->style_id) . ' - ';
}
else {
$operations .= l(t('Disable'), 'admin/settings/sweaver/styles/disable/' . $style->style_id) . ' - ';
}
$operations .= l(t('Delete'), 'admin/settings/sweaver/styles/delete/' . $style->style_id);
$row[] = $operations;
$rows[] = $row;
}
if (empty($rows)) {
$output = '<p>' . t('No styles found.') . '</p>';
}
else {
$header = array(
t('Style'),
t('Theme'),
t('Status'),
t('Operations'),
);
// Styles list.
$output = theme('table', $header, $rows);
}
$form['item'] = array(
'#type' => 'item',
'#value' => $output,
);
return $form;
}