Last active
August 29, 2015 14:15
-
-
Save pounard/475a6568cecc65f64f29 to your computer and use it in GitHub Desktop.
Those lines may save your life whenever you use the advanced_forum module.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_process(). | |
*/ | |
function MYTHEMEORMODULE_process(&$variables, $hook) { | |
// Seems legit. | |
// @see laborange2_theme_registry_alter(). | |
if (false === strpos($hook, 'advanced_forum')) { | |
// This one is a stupid variable mis-use and typo from advanced_forum. | |
if (!empty($variables['theme_hook_suggestion']) && false !== strpos($variables['theme_hook_suggestion'], 'advanced_forum')) { | |
// Do not override the 'theme_hook_suggestion' other than advanced | |
// forums ones, because using theme(ARRAY_OF_HOOKS) actually uses | |
// it legitimately (or not). | |
unset($variables['theme_hook_suggestion']); | |
} | |
// And this one is because advanced_forum templates are stupid too. | |
if (!empty($variables['theme_hook_suggestions'])) { | |
foreach ($variables['theme_hook_suggestions'] as $i => $value) { | |
if ('a' === $value[0] && 0 === strpos($value, 'advanced_forum')) { | |
unset($variables['theme_hook_suggestions'][$i]); | |
} | |
} | |
} | |
} | |
} | |
/** | |
* Implements hook_theme_registry_alter(). | |
*/ | |
function MYTHEMEORMODULE_theme_registry_alter(&$theme_registry) { | |
// Seems legit too. | |
// @see MYTHEMEORMODULE_process(). | |
foreach (array('node', 'comment') as $key) { | |
if (isset($theme_registry[$key]['preprocess functions'])) { | |
foreach ($theme_registry[$key]['preprocess functions'] as $i => $value) { | |
if ('a' === $value[0] && 0 === strpos($value, 'advanced_forum')) { | |
unset($theme_registry[$key]['preprocess functions'][$i]); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment