legend > a").click(function(){ if(!$("fieldset.node_settings").hasClass("collapsed")) { Drupal.toggleFieldset($("fieldset.node_settings")); } }); $("fieldset.node_settings > legend > a").click(function(){ if (!$("fieldset.general_settings").hasClass("collapsed")) { Drupal.toggleFieldset($("fieldset.general_settings")); } }); }); SCRIPT; drupal_add_js($js, 'inline'); // Get the node types $node_types = node_get_types('names'); /** * The default values for the theme variables. Make sure $defaults exactly * matches the $defaults in the template.php file. */ $defaults = array( 'user_notverified_display' => 1, 'breadcrumb_display' => 'yes', 'breadcrumb_separator' => ' » ', 'breadcrumb_home' => 0, 'breadcrumb_trailing' => 0, 'breadcrumb_title' => 0, 'search_snippet' => 1, 'search_info_type' => 1, 'search_info_user' => 1, 'search_info_date' => 1, 'search_info_comment' => 1, 'search_info_upload' => 1, 'mission_statement_pages' => 'home', 'taxonomy_display_default' => 'only', 'taxonomy_format_default' => 'vocab', 'taxonomy_enable_content_type' => 0, 'submitted_by_author_default' => 1, 'submitted_by_date_default' => 1, 'submitted_by_enable_content_type' => 0, 'rebuild_registry' => 0, 'load_firebug_lite' => 0, 'at_admin_theme' => 1, 'at_admin_theme_node' => 1, 'at_admin_theme_logo' => 0, 'admin_user_links' => 1, 'block_edit_links' => 1, 'at_admin_hide_help' => 0, 'layout_method' => '0', 'layout_width' => '960px', 'layout_sidebar_first_width' => '240', 'layout_sidebar_last_width' => '240', 'layout_enable_settings' => 'off', // set to 'on' to enable, 'off' to disable 'layout_enable_width' => 'off', // set to 'on' to enable, 'off' to disable 'layout_enable_sidebars' => 'off', // set to 'on' to enable, 'off' to disable 'layout_enable_method' => 'off', // set to 'on' to enable, 'off' to disable 'equal_heights_sidebars' => 0, 'equal_heights_blocks' => 0, 'horizontal_login_block' => 0, 'horizontal_login_block_overlabel' => 0, 'horizontal_login_block_enable' => 'off', // set to 'on' to enable, 'off' to disable 'color_schemes' => 'colors-default.css', 'color_enable_schemes' => 'off', // set to 'on' to enable, 'off' to disable ); // Make the default content-type settings the same as the default theme settings, // so we can tell if content-type-specific settings have been altered. $defaults = array_merge($defaults, theme_get_settings()); // Set the default values for content-type-specific settings foreach ($node_types as $type => $name) { $defaults["taxonomy_display_{$type}"] = $defaults['taxonomy_display_default']; $defaults["taxonomy_format_{$type}"] = $defaults['taxonomy_format_default']; $defaults["submitted_by_author_{$type}"] = $defaults['submitted_by_author_default']; $defaults["submitted_by_date_{$type}"] = $defaults['submitted_by_date_default']; } // Merge the saved variables and their default values $settings = array_merge($defaults, $saved_settings); // Create theme settings form widgets using Forms API // General Settings $form['general_settings'] = array( '#type' => 'fieldset', '#title' => t('General settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#attributes' => array('class' => 'general_settings'), ); // Mission Statement $form['general_settings']['mission_statement'] = array( '#type' => 'fieldset', '#title' => t('Mission statement'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['general_settings']['mission_statement']['mission_statement_pages'] = array( '#type' => 'radios', '#title' => t('Where should the mission statement be displayed?'), '#default_value' => $settings['mission_statement_pages'], '#options' => array( 'home' => t('Display the mission statement only on the home page'), 'all' => t('Display the mission statement on all pages'), ), ); $form['general_settings']['breadcrumb'] = array( '#type' => 'fieldset', '#title' => t('Breadcrumb'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['general_settings']['breadcrumb']['breadcrumb_display'] = array( '#type' => 'select', '#title' => t('Display breadcrumb'), '#default_value' => $settings['breadcrumb_display'], '#options' => array( 'yes' => t('Yes'), 'no' => t('No'), 'admin' => t('Only in the admin section'), ), ); $form['general_settings']['breadcrumb']['breadcrumb_separator'] = array( '#type' => 'textfield', '#title' => t('Breadcrumb separator'), '#description' => t('Text only. Dont forget to include spaces.'), '#default_value' => $settings['breadcrumb_separator'], '#size' => 8, '#maxlength' => 10, '#prefix' => '
', ); // Username $form['general_settings']['username'] = array( '#type' => 'fieldset', '#title' => t('Username'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['general_settings']['username']['user_notverified_display'] = array( '#type' => 'checkbox', '#title' => t('Display "not verified" for unregistered user names'), '#default_value' => $settings['user_notverified_display'], ); // Search Settings $form['general_settings']['search_container'] = array( '#type' => 'fieldset', '#title' => t('Search results'), '#description' => t('What additional information should be displayed in your search results?'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['general_settings']['search_container']['search_results']['search_snippet'] = array( '#type' => 'checkbox', '#title' => t('Display text snippet'), '#default_value' => $settings['search_snippet'], ); $form['general_settings']['search_container']['search_results']['search_info_type'] = array( '#type' => 'checkbox', '#title' => t('Display content type'), '#default_value' => $settings['search_info_type'], ); $form['general_settings']['search_container']['search_results']['search_info_user'] = array( '#type' => 'checkbox', '#title' => t('Display author name'), '#default_value' => $settings['search_info_user'], ); $form['general_settings']['search_container']['search_results']['search_info_date'] = array( '#type' => 'checkbox', '#title' => t('Display posted date'), '#default_value' => $settings['search_info_date'], ); $form['general_settings']['search_container']['search_results']['search_info_comment'] = array( '#type' => 'checkbox', '#title' => t('Display comment count'), '#default_value' => $settings['search_info_comment'], ); $form['general_settings']['search_container']['search_results']['search_info_upload'] = array( '#type' => 'checkbox', '#title' => t('Display attachment count'), '#default_value' => $settings['search_info_upload'], ); // Node Settings $form['node_type_specific'] = array( '#type' => 'fieldset', '#title' => t('Node settings'), '#description' => t('Here you can make adjustments to which information is shown with your content, and how it is displayed. You can modify these settings so they apply to all content types, or check the "Use content-type specific settings" box to customize them for each content type. For example, you may want to show the date on Stories, but not Pages.'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#attributes' => array('class' => 'node_settings'), ); // Author & Date Settings $form['node_type_specific']['submitted_by_container'] = array( '#type' => 'fieldset', '#title' => t('Author & date'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); if (module_exists('submitted_by') == FALSE) { // Default & content-type specific settings foreach ((array('default' => 'Default') + node_get_types('names')) as $type => $name) { $form['node_type_specific']['submitted_by_container']['submitted_by'][$type] = array( '#type' => 'fieldset', '#title' => t('!name', array('!name' => t($name))), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['node_type_specific']['submitted_by_container']['submitted_by'][$type]["submitted_by_author_{$type}"] = array( '#type' => 'checkbox', '#title' => t('Display author\'s username'), '#default_value' => $settings["submitted_by_author_{$type}"], ); $form['node_type_specific']['submitted_by_container']['submitted_by'][$type]["submitted_by_date_{$type}"] = array( '#type' => 'checkbox', '#title' => t('Display date posted (you can customize this format on the Date and Time settings page.)'), '#default_value' => $settings["submitted_by_date_{$type}"], ); // Options for default settings if ($type == 'default') { $form['node_type_specific']['submitted_by_container']['submitted_by']['default']['#title'] = t('Default'); $form['node_type_specific']['submitted_by_container']['submitted_by']['default']['#collapsed'] = $settings['submitted_by_enable_content_type'] ? TRUE : FALSE; $form['node_type_specific']['submitted_by_container']['submitted_by']['submitted_by_enable_content_type'] = array( '#type' => 'checkbox', '#title' => t('Use custom settings for each content type instead of the default above.'), '#default_value' => $settings['submitted_by_enable_content_type'], ); } // Collapse content-type specific settings if default settings are being used else if ($settings['submitted_by_enable_content_type'] == 0) { $form['submitted_by'][$type]['#collapsed'] = TRUE; } } } else { $form['node_type_specific']['submitted_by_container']['#description'] = t('NOTICE: You currently have the "Submitted by" module installed and enabled, so the author and date theme settings have been disabled to prevent conflicts. If you later wish to re-enable the author and date theme settings, you must first disable the "Submitted by" module.'); $form['node_type_specific']['submitted_by_container']['submitted_by'][$type]['#disabled'] = 'disabled'; } // Taxonomy Settings if (module_exists('taxonomy')) { $form['node_type_specific']['display_taxonomy_container'] = array( '#type' => 'fieldset', '#title' => t('Taxonomy terms'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); // Default & content-type specific settings foreach ((array('default' => 'Default') + node_get_types('names')) as $type => $name) { // taxonomy display per node $form['node_type_specific']['display_taxonomy_container']['display_taxonomy'][$type] = array( '#type' => 'fieldset', '#title' => t('!name', array('!name' => t($name))), '#collapsible' => TRUE, '#collapsed' => TRUE, ); // Display $form['node_type_specific']['display_taxonomy_container']['display_taxonomy'][$type]["taxonomy_display_{$type}"] = array( '#type' => 'select', '#title' => t('When should taxonomy terms be displayed?'), '#default_value' => $settings["taxonomy_display_{$type}"], '#options' => array( '' => '', 'never' => t('Never display taxonomy terms'), 'all' => t('Always display taxonomy terms'), 'only' => t('Only display taxonomy terms on full node pages'), ), ); // Formatting $form['node_type_specific']['display_taxonomy_container']['display_taxonomy'][$type]["taxonomy_format_{$type}"] = array( '#type' => 'radios', '#title' => t('Taxonomy display format'), '#default_value' => $settings["taxonomy_format_{$type}"], '#options' => array( 'vocab' => t('Display each vocabulary on a new line'), 'list' => t('Display all taxonomy terms together in single list'), ), ); // Get taxonomy vocabularies by node type $vocabs = array(); $vocabs_by_type = ($type == 'default') ? taxonomy_get_vocabularies() : taxonomy_get_vocabularies($type); foreach ($vocabs_by_type as $key => $value) { $vocabs[$value->vid] = $value->name; } // Display taxonomy checkboxes foreach ($vocabs as $key => $vocab_name) { $form['node_type_specific']['display_taxonomy_container']['display_taxonomy'][$type]["taxonomy_vocab_display_{$type}_{$key}"] = array( '#type' => 'checkbox', '#title' => t('Display vocabulary: '. $vocab_name), '#default_value' => $settings["taxonomy_vocab_display_{$type}_{$key}"], ); } // Options for default settings if ($type == 'default') { $form['node_type_specific']['display_taxonomy_container']['display_taxonomy']['default']['#title'] = t('Default'); $form['node_type_specific']['display_taxonomy_container']['display_taxonomy']['default']['#collapsed'] = $settings['taxonomy_enable_content_type'] ? TRUE : FALSE; $form['node_type_specific']['display_taxonomy_container']['display_taxonomy']['taxonomy_enable_content_type'] = array( '#type' => 'checkbox', '#title' => t('Use custom settings for each content type instead of the default above'), '#default_value' => $settings['taxonomy_enable_content_type'], ); } // Collapse content-type specific settings if default settings are being used else if ($settings['taxonomy_enable_content_type'] == 0) { $form['display_taxonomy'][$type]['#collapsed'] = TRUE; } } } // Development settings $form['themedev'] = array( '#type' => 'fieldset', '#title' => t('Theme development settings'), '#collapsible' => TRUE, '#collapsed' => $settings['rebuild_registry'] ? FALSE : TRUE, ); $form['themedev']['rebuild_registry'] = array( '#type' => 'checkbox', '#title' => t('Rebuild theme registry on every page.'), '#default_value' => $settings['rebuild_registry'], '#description' => t('During theme development, it can be very useful to continuously rebuild the theme registry. WARNING! This is a performance penalty and must be turned off on production websites.', array('!link' => 'http://drupal.org/node/173880#theme-registry')), ); $form['themedev']['load_firebug_lite'] = array( '#type' => 'checkbox', '#title' => t('Load Firebug lite script for debugging in IE, Opera and Webkit.'), '#default_value' => $settings['load_firebug_lite'], '#description' => t('WARNING! To use Firebug lite you must first download and install the script to the /js/core/ directory in your theme. Download Firebug lite.', array('!link' => 'http://getfirebug.com/lite.html')), ); // Admin settings $form['admin_settings']['administration'] = array( '#type' => 'fieldset', '#title' => t('Admin settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['admin_settings']['administration']['at_admin_theme'] = array( '#type' => 'checkbox', '#title' => t('Use the Administration theme for admin pages.'), '#default_value' => $settings['at_admin_theme'], '#description' => t('The site will use the built in Administration theme for admin pages.'), ); $form['admin_settings']['administration']['at_admin_theme_node'] = array( '#type' => 'checkbox', '#title' => t('Use the Administration theme for node add/edit/delete pages.'), '#default_value' => $settings['at_admin_theme_node'], '#description' => t('The site will use the built in Administration theme for for node add, edit and delete pages.'), ); $form['admin_settings']['administration']['at_admin_theme_logo'] = array( '#type' => 'checkbox', '#title' => t('Show site logo on admin pages.'), '#default_value' => $settings['at_admin_theme_logo'], '#description' => t('When checked the site logo will show on admin pages.'), ); $form['admin_settings']['administration']['admin_user_links'] = array( '#type' => 'checkbox', '#title' => t('Show the built in Admin user menu link.'), '#default_value' => $settings['admin_user_links'], '#description' => t('This will show or hide useful links in the header depending on what permissions the users role has been assigned.'), ); $form['admin_settings']['administration']['block_edit_links'] = array( '#type' => 'checkbox', '#title' => t('Show block editing and configuration links.'), '#default_value' => $settings['block_edit_links'], '#description' => t('When hovering or over a block or viewing blocks in the blocks list page, privileged users will see block editing and configuration links.'), ); $form['admin_settings']['administration']['at_admin_hide_help'] = array( '#type' => 'checkbox', '#title' => t('Hide help messages.'), '#default_value' => $settings['at_admin_hide_help'], '#description' => t('When this setting is checked all help messages will be hidden.'), ); // Layout settings $form['layout'] = array( '#type' => 'fieldset', '#title' => t('Layout settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); if ($settings['layout_enable_settings'] == 'on') { $image_path = path_to_theme() .'/css/core/core-images'; $form['layout']['page_layout'] = array( '#type' => 'fieldset', '#title' => t('Page Layout'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#description' => t('Use these settings to customize the layout of your site. NOTE: If you have the built-in Admin theme enabled these settings will not affect the Admin section; they only apply to the "front end" theme. If no overrides are set the default layout will apply.'), ); if ($settings['layout_enable_width'] == 'on') { $form['layout']['page_layout']['layout_width_help'] = array( '#prefix' => '