diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-05-05 07:35:58 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-05-05 07:35:58 +0000 |
commit | 6658273b36ffc64a6c2ba66bf08cda9f3923252d (patch) | |
tree | a8f0f2d17b4d33f95c3cf9b7124c3f0bf03b8ec7 /includes | |
parent | 381980cb03fad0e5b929c7fba531692d116aa915 (diff) | |
download | brdo-6658273b36ffc64a6c2ba66bf08cda9f3923252d.tar.gz brdo-6658273b36ffc64a6c2ba66bf08cda9f3923252d.tar.bz2 |
- Patch #21855 by TDobes: the recent commit of phptemplate caused a number of problems for non-phptemplate themes. A patch is attached to address these issues.
Changes include:
* parsing of the primary/secondary links has been moved out of phptemplate and into theme_get_setting.
* unnecessary and XHTML-invalidating duplicate div#help removed from themes/bluemarine/page.tpl.php (this is already generated by theme_help)
* weird generation of the "edit primary/secondary links" messages removed from bluemarine and placed in theme.inc
* unnecessary changes to themes/bluemarine/style.css rolled back (the phptemplate bluemarine had an older version of style.css than the one in core)
* chameleon updated to work with new link scheme (passes links through theme_links)
Diffstat (limited to 'includes')
-rw-r--r-- | includes/theme.inc | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 0bc46252a..6b210c55e 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -289,12 +289,38 @@ function theme_get_setting($setting_name, $refresh = FALSE) { } } - if (!$settings['toggle_primary_links']) { - $settings['primary_links'] = ''; - } - - if (!$settings['toggle_secondary_links']) { - $settings['secondary_links'] = ''; + foreach (array('primary', 'secondary') as $type) { + // Get the data to populate the textfields, if the variable is not an array .. try to parse the old-style link format. + $value = $settings[$type . '_links']; + + // Clear out existing (internal) values + $settings[$type .'_links'] = array(); + + // Get the amount of links to show, possibly expanding if there are more links defined than the count specifies. + $count = variable_get($type . '_link_count', 5); + $count = ($count > sizeof($value['link'])) ? $count : sizeof($value['link']); + + if ($settings['toggle_' . $type . '_links']) { + for ($i =0; $i < $count; $i++) { + unset($attributes); + if (!empty($value['text'][$i])) { + if (!empty($value['description'][$i])) { + $attributes['title'] = $value['description'][$i]; + } + $text = $value['text'][$i]; + $link = $value['link'][$i]; + if (substr($link, 0, 7) == 'http://') { + $settings[$type .'_links'][] = '<a href="'. $link .'"'. drupal_attributes($attributes) .'>'. $text .'</a>'; + } + else { + $settings[$type .'_links'][] = l($text, $link, $attributes); + } + } + } + if ($settings[$type .'_links'] == array()) { + $settings[$type .'_links'] = array(l(t('edit %type links', array('%type' => $type)),'admin/themes/settings')); + } + } } } |