array( 'title' => t('Administer Delta'), 'description' => t('Administer settings for the Delta module.'), ), ); } /** * Implementation of hook_menu(). */ 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/templates'] = array( 'title' => 'Templates', 'description' => 'Manage theme setting templates.', 'page callback' => 'delta_templates_view', 'access arguments' => array('administer delta'), 'file' => 'delta_ui.admin.inc', 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/appearance/delta', ); $items['admin/appearance/delta/templates/list'] = array( 'title' => 'List', 'description' => 'Manage your theme setting templates.', 'type' => MENU_DEFAULT_LOCAL_TASK, 'parent' => 'admin/appearance/delta/templates', 'weight' => -1, ); $items['admin/appearance/delta/templates/add'] = array( 'title' => 'Add Template', 'description' => 'Create a new theme setting template.', 'page callback' => 'drupal_get_form', 'page arguments' => array('delta_template_edit'), 'access arguments' => array('administer delta'), 'file' => 'delta_ui.admin.inc', 'type' => MENU_LOCAL_ACTION, 'parent' => 'admin/appearance/delta/templates', ); $items['admin/appearance/delta/templates/edit/%'] = array( 'title' => 'Edit', 'description' => 'Edit a Theme Settings Template.', 'page callback' => 'drupal_get_form', 'page arguments' => array('delta_template_edit', 5), 'access arguments' => array('administer delta'), 'file' => 'delta_ui.admin.inc', 'type' => MENU_NORMAL_ITEM, 'tab_parent' => 'admin/appearance/delta/templates', ); $items['admin/appearance/delta/templates/configure/%'] = array( 'title' => 'Settings', 'description' => 'Override settings for Template.', 'page callback' => 'drupal_get_form', 'page arguments' => array('delta_template_configure', 5), 'access arguments' => array('administer delta'), 'file' => 'delta_ui.admin.inc', 'type' => MENU_NORMAL_ITEM, 'tab_parent' => 'admin/appearance/delta/templates', ); $items['admin/appearance/delta/templates/delete/%'] = array( 'title' => 'Delete', 'description' => 'Delete Theme Settings Template.', 'page callback' => 'drupal_get_form', 'page arguments' => array('delta_template_delete', 5), 'access arguments' => array('administer delta'), 'file' => 'delta_ui.admin.inc', 'type' => MENU_NORMAL_ITEM, 'tab_parent' => 'admin/appearance/delta/templates', ); return $items; } /** * Pull data from actively selected themes * @return the full theme array as normally pulled by list_themes(), but filters out the inactive themes. */ 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) { // let's gather active themes only, and the ones that have been set in Delta API global settings if ($theme->status == 1 && isset($configurable_themes[$theme->name]) && $configurable_themes[$theme->name]) { $themes[$name] = $theme; } } return $themes; } return FALSE; } /** * Pull data from actively selected themes * @return a usable array of theme data for use in forms for checkboxes or radio buttons */ 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) { // let's gather active themes only 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; } /** * Called when saving the default delta settings form. * This is needed to rebuild the menu when an update occurs in order to * Add/Remove any themes that need to be in the menu system for rendering * the appropriate sub-tabs. */ function delta_menu_rebuild() { menu_rebuild(); menu_cache_clear_all(); } /** * Implmentation of hook_form_alter for delta_theme_settings_config() * @return $form * @see http://api.drupal.org/api/function/hook_form_FORM_ID_alter/6 * @see http://api.drupal.org/api/function/hook_form_alter/6 */ function delta_form_delta_theme_settings_config_alter(&$form, &$form_state) { // adding submit handler to rebuild the menu on submitting this form $form['#submit'][] = 'delta_menu_rebuild'; } function delta_ui_form_delta_template_configure_alter($form, &$form_state) { } function delta_ui_template_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_template_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/templates'); } function delta_ui_template_configure_validate($form, &$form_state) { }