diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2011-01-03 08:02:11 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2011-01-03 08:02:11 +0000 |
commit | 8a6c97a1ceaf648bdbff6b8cb80d24c00935e300 (patch) | |
tree | f448cc6fdf9bef0968e9035a725a8caaab9037f9 /includes/theme.inc | |
parent | c5da457f287cdeadc62bcaa3702b1a1bcf29b6ea (diff) | |
download | brdo-8a6c97a1ceaf648bdbff6b8cb80d24c00935e300.tar.gz brdo-8a6c97a1ceaf648bdbff6b8cb80d24c00935e300.tar.bz2 |
#992376 by larowlan: Fixed Paths containing a hyphen aren't compatible with page theme_hook_suggestions
Diffstat (limited to 'includes/theme.inc')
-rw-r--r-- | includes/theme.inc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 44946cf53..c5015865d 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2364,8 +2364,19 @@ function theme_get_suggestions($args, $base, $delimiter = '__') { $suggestions = array(); $prefix = $base; foreach ($args as $arg) { - // Remove slashes or null per SA-CORE-2009-003. - $arg = str_replace(array("/", "\\", "\0"), '', $arg); + // Remove slashes or null per SA-CORE-2009-003 and change - (hyphen) to _ + // (underscore). + // + // When we discover templates in @see drupal_find_theme_templates, + // hyphens (-) are converted to underscores (_) before the theme hook + // is registered. We do this because the hyphens used for delimiters + // in hook suggestions cannot be used in the function names of the + // associated preprocess functions. Any page templates designed to be used + // on paths that contain a hyphen are also registered with these hyphens + // converted to underscores so here we must convert any hyphens in path + // arguments to underscores here before fetching theme hook suggestions + // to ensure the templates are appropriately recognized. + $arg = str_replace(array("/", "\\", "\0", '-'), array('', '', '', '_'), $arg); // The percent acts as a wildcard for numeric arguments since // asterisks are not valid filename characters on many filesystems. if (is_numeric($arg)) { |