View source
<?php
function delta_ui_permission() {
return array(
'administer delta' => array(
'title' => t('Administer Delta'),
'description' => t('Administer settings for the Delta module.'),
),
);
}
function delta_ui_menu() {
$items['admin/appearance/delta'] = array(
'title' => 'Delta',
'description' => 'Manage your delta settings and rules, import and export delta settings for each theme',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'delta_theme_settings_config',
),
'access arguments' => array(
'administer delta',
),
'file' => 'delta_ui.admin.inc',
'type' => MENU_LOCAL_TASK,
);
$items['admin/appearance/delta/settings'] = array(
'title' => 'Settings',
'description' => 'Manage Delta settings.',
'type' => MENU_DEFAULT_LOCAL_TASK,
'parent' => 'admin/appearance/delta',
'weight' => -10,
);
$items['admin/appearance/delta/layouts'] = array(
'title' => 'Layouts',
'description' => 'Manage theme setting layouts.',
'page callback' => 'delta_layouts_view',
'access arguments' => array(
'administer delta',
),
'file' => 'delta_ui.admin.inc',
'type' => MENU_LOCAL_TASK,
'parent' => 'admin/appearance/delta',
);
$items['admin/appearance/delta/layouts/list'] = array(
'title' => 'List',
'description' => 'Manage your theme setting layouts.',
'type' => MENU_DEFAULT_LOCAL_TASK,
'parent' => 'admin/appearance/delta/layouts',
'weight' => -1,
);
$items['admin/appearance/delta/layouts/add'] = array(
'title' => 'Add Template',
'description' => 'Create a new theme setting layout.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'delta_layout_edit',
),
'access arguments' => array(
'administer delta',
),
'file' => 'delta_ui.admin.inc',
'type' => MENU_LOCAL_ACTION,
'parent' => 'admin/appearance/delta/layouts',
);
$items['admin/appearance/delta/layouts/edit/%'] = array(
'title' => 'Edit',
'description' => 'Edit a Theme Settings Layout.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'delta_layout_edit',
5,
),
'access arguments' => array(
'administer delta',
),
'file' => 'delta_ui.admin.inc',
'type' => MENU_NORMAL_ITEM,
'tab_parent' => 'admin/appearance/delta/layouts',
);
$items['admin/appearance/delta/layouts/configure/%'] = array(
'title' => 'Settings',
'description' => 'Override settings for Layout.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'delta_layout_configure',
5,
),
'access arguments' => array(
'administer delta',
),
'file' => 'delta_ui.admin.inc',
'type' => MENU_NORMAL_ITEM,
'tab_parent' => 'admin/appearance/delta/layouts',
);
$items['admin/appearance/delta/layouts/delete/%'] = array(
'title' => 'Delete',
'description' => 'Delete Theme Settings Layout.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'delta_layout_delete',
5,
),
'access arguments' => array(
'administer delta',
),
'file' => 'delta_ui.admin.inc',
'type' => MENU_NORMAL_ITEM,
'tab_parent' => 'admin/appearance/delta/layouts',
);
return $items;
}
function delta_get_themes_array() {
$system_themes = list_themes();
$themes = array();
$configurable_themes = variable_get('delta_themes', array());
if (is_array($system_themes)) {
foreach ($system_themes as $name => $theme) {
if ($theme->status == 1 && isset($configurable_themes[$theme->name]) && $configurable_themes[$theme->name]) {
$themes[$name] = $theme;
}
}
return $themes;
}
return FALSE;
}
function delta_get_themes_form_array(&$filter) {
$system_themes = list_themes();
$configurable_themes = variable_get('delta_themes', array());
$themes = array();
if (is_array($system_themes)) {
foreach ($system_themes as $name => $theme) {
if (!$filter) {
if ($theme->status == 1) {
$themes[$name] = $theme->info['name'];
}
}
else {
if ($theme->status == 1 && isset($configurable_themes[$theme->name]) && $configurable_themes[$theme->name]) {
$themes[$name] = $theme->info['name'];
}
}
}
return $themes;
}
return FALSE;
}
function delta_menu_rebuild() {
menu_rebuild();
menu_cache_clear_all();
}
function delta_form_delta_theme_settings_config_alter(&$form, &$form_state) {
$form['#submit'][] = 'delta_menu_rebuild';
}
function delta_ui_form_delta_layout_configure_alter($form, &$form_state) {
}
function delta_ui_layout_configure_submit($form, &$form_state) {
$values = $form_state['values'];
$values = $form_state['values'];
$key = $values['var'];
unset($values['var'], $values['submit'], $values['reset'], $values['form_id'], $values['op'], $values['form_build_id'], $values['form_token'], $values['toggle_logo'], $values['toggle_name'], $values['toggle_slogan'], $values['toggle_node_user_picture'], $values['toggle_comment_user_picture'], $values['toggle_comment_user_verification'], $values['toggle_favicon'], $values['toggle_main_menu'], $values['toggle_secondary_menu'], $values['default_logo'], $values['logo_path'], $values['logo_upload'], $values['default_favicon'], $values['favicon_path'], $values['favicon_upload'], $values['theme_settings_export_code']);
variable_set($key, $values);
drupal_set_message(t('The configuration options have been saved.'));
cache_clear_all();
}
function delta_ui_layout_delete_submit($form, &$form_state) {
$values = $form_state['values'];
$key = $values['tid'];
variable_del($key, $values);
db_delete('delta_theme_settings')
->condition('tid', $key)
->execute();
drupal_set_message(t('The item has been deleted.'));
cache_clear_all();
drupal_goto('admin/appearance/delta/layouts');
}
function delta_ui_layout_configure_validate($form, &$form_state) {
}