From 30ac69457fc611c8ea4a25c8e84f792dbdac9b2e Mon Sep 17 00:00:00 2001 From: Tim Steiner <tsteiner2@unl.edu> Date: Mon, 10 Oct 2011 20:31:31 +0000 Subject: [PATCH] [gh-236] Merging from testing into staging git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@1142 20a16fea-79d4-4915-8869-1ea9d5ebf173 --- sites/all/modules/unl/includes/unl.admin.inc | 28 ++++++++++++++++++++ sites/all/modules/unl/unl.info | 1 + sites/all/modules/unl/unl.module | 24 ++++++++++++++++- sites/all/themes/unl_wdn/html.tpl.php | 6 ----- sites/all/themes/unl_wdn/theme-settings.php | 6 ----- sites/all/themes/unl_wdn/unl_wdn.info | 1 - 6 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 sites/all/modules/unl/includes/unl.admin.inc diff --git a/sites/all/modules/unl/includes/unl.admin.inc b/sites/all/modules/unl/includes/unl.admin.inc new file mode 100644 index 00000000..7fd339b3 --- /dev/null +++ b/sites/all/modules/unl/includes/unl.admin.inc @@ -0,0 +1,28 @@ +<?php + +function unl_config($form, &$form_state) { + + $form['root'] = array( + '#tree' => TRUE, + '#type' => 'fieldset', + '#title' => 'UNL Settings', + ); + + $form['root']['unl_use_base_tag'] = array( + '#type' => 'checkbox', + '#title' => 'Use Base Tag', + '#description' => 'Insert the HTML Base tag in the head of all pages on this site.', + '#default_value' => variable_get('unl_use_base_tag', TRUE), + ); + + $form['submit'] = array( + '#type' => 'submit', + '#value' => 'Update', + ); + + return $form; +} + +function unl_config_submit($form, &$form_state) { + variable_set('unl_use_base_tag', $form_state['values']['root']['unl_use_base_tag']); +} diff --git a/sites/all/modules/unl/unl.info b/sites/all/modules/unl/unl.info index d030c496..52f3787a 100644 --- a/sites/all/modules/unl/unl.info +++ b/sites/all/modules/unl/unl.info @@ -4,6 +4,7 @@ package = UNL dependencies[] = wysiwyg core = 7.x version = "7.x-1.0-20100920" +configure = admin/config/system/unl files[] = unl.install files[] = unl.module diff --git a/sites/all/modules/unl/unl.module b/sites/all/modules/unl/unl.module index 4d166f8a..ef830281 100644 --- a/sites/all/modules/unl/unl.module +++ b/sites/all/modules/unl/unl.module @@ -330,6 +330,17 @@ function unl_menu() { 'page callback' => 'unl_still_alive', 'access callback' => TRUE, ); + + // UNL + $items['admin/config/system/unl'] = array( + 'title' => 'UNL', + 'description' => 'Configure UNL System Settings', + 'access callback' => 'unl_user_is_administrator', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('unl_config'), + 'file' => 'includes/unl.admin.inc', + 'weight' => 1, + ); if (module_exists('imce')) { // Add IMCE file browser to Content section @@ -961,6 +972,18 @@ function unl_init() { drupal_goto($primary_base_url . current_path()); } } + + if (variable_get('unl_use_base_tag', TRUE)) { + $base_tag = array( + '#type' => 'html_tag', + '#tag' => 'base', + '#attributes' => array( + 'href' => url('<front>', array('absoule' => TRUE)), + ), + ); + drupal_add_html_head($base_tag, 'base'); + } + _unl_handle_directory_index(); } @@ -1253,4 +1276,3 @@ function unl_block_view_my_sites() - diff --git a/sites/all/themes/unl_wdn/html.tpl.php b/sites/all/themes/unl_wdn/html.tpl.php index 7ed1cea4..8f4250be 100644 --- a/sites/all/themes/unl_wdn/html.tpl.php +++ b/sites/all/themes/unl_wdn/html.tpl.php @@ -33,12 +33,6 @@ $t = unl_wdn_get_instance(); -if (theme_get_setting('use_base')) { - $t->head = PHP_EOL - . '<base href="' . url('<front>', array('absolute' => TRUE)) . '" />' . PHP_EOL - . $t->head; -} - $t->head .= PHP_EOL . $head . PHP_EOL . $styles . PHP_EOL diff --git a/sites/all/themes/unl_wdn/theme-settings.php b/sites/all/themes/unl_wdn/theme-settings.php index 1333f0dd..b2998e18 100644 --- a/sites/all/themes/unl_wdn/theme-settings.php +++ b/sites/all/themes/unl_wdn/theme-settings.php @@ -69,12 +69,6 @@ function unl_wdn_form_system_theme_settings_alter(&$form, &$form_state) { '#default_value' => theme_get_setting('zen_forms'), '#description' => t('Transforms all forms into the list-based zen forms.'), ), - 'use_base' => array( - '#type' => 'checkbox', - '#title' => t('Use HTML Base Tag in Head'), - '#default_value' => theme_get_setting('use_base'), - '#description' => t('Adds an HTML Base tag to the <head> section with href="' . url('<front>', array('absolute' => TRUE)) . '"'), - ), 'wdn_beta' => array( '#type' => 'checkbox', '#title' => t('Use WDN Beta/Development CSS and JavaScript'), diff --git a/sites/all/themes/unl_wdn/unl_wdn.info b/sites/all/themes/unl_wdn/unl_wdn.info index 30c540f6..c6a05a8b 100644 --- a/sites/all/themes/unl_wdn/unl_wdn.info +++ b/sites/all/themes/unl_wdn/unl_wdn.info @@ -31,7 +31,6 @@ plugins[panels][layouts] = layouts settings[toggle_favicon] = 0 settings[zen_forms] = 0 -settings[use_base] = 1 settings[wdn_beta] = 0 settings[sidebar_first_width] = 3 settings[sidebar_second_width] = 3 -- GitLab