-
Notifications
You must be signed in to change notification settings - Fork 0
/
panopoly_news.module
40 lines (35 loc) · 1.17 KB
/
panopoly_news.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* @file
* Code for the Panopoly News feature.
*/
include_once 'panopoly_news.features.inc';
/**
* Allows us to add node--panopoly-news-article.tpl.php to the
* registry.
*
* http://www.metachunk.com/blog/adding-module-path-drupal-7-theme-registry
*
* Implements hook_theme_registry_alter()
**/
function panopoly_news_theme_registry_alter(&$theme_registry) {
$mod_path = drupal_get_path('module', 'panopoly_news') . '/theme/templates';
$theme_registry_copy = $theme_registry; // munge on a copy
_theme_process_registry($theme_registry_copy, 'phptemplate', 'theme_engine', 'pow', $mod_path);
$theme_registry += array_diff_key($theme_registry_copy, $theme_registry);
$hooks = array('node');
foreach ($hooks as $h) {
_panopoly_news_insert_after_first_element($theme_registry[$h]['theme paths'], $mod_path);
}
}
/**
* Helper function for re-ordering arrays (needed by theme_registry_alter)
*
* http://www.metachunk.com/blog/adding-module-path-drupal-7-theme-registry
*/
function _panopoly_news_insert_after_first_element(&$a, $element) {
if(is_array($a)) {
$first_element = array_shift($a);
array_unshift($a, $first_element, $element);
}
}