Révision 4f315dab
Ajouté par Assos Assos il y a environ 8 ans
drupal7/sites/all/modules/ds/tests/ds_test.module | ||
---|---|---|
24 | 24 |
->execute(); |
25 | 25 |
} |
26 | 26 |
|
27 |
/** |
|
28 |
* Implements hook_theme_registry_alter(). |
|
29 |
*/ |
|
30 |
function ds_test_theme_registry_alter(&$theme_registry) { |
|
31 |
|
|
32 |
// Inject ds_entity_variables in all entity theming functions. |
|
33 |
$entity_info = entity_get_info(); |
|
34 |
foreach ($entity_info as $entity => $info) { |
|
35 |
if (isset($entity_info[$entity]['fieldable']) && $entity_info[$entity]['fieldable']) { |
|
36 |
|
|
37 |
// User uses user_profile for theming. |
|
38 |
if ($entity == 'user') $entity = 'user_profile'; |
|
39 |
|
|
40 |
// Only add preprocess functions if entity exposes theme function. |
|
41 |
if (isset($theme_registry[$entity])) { |
|
42 |
$theme_registry[$entity]['preprocess functions'][] = 'ds_test_entity_variables'; |
|
43 |
} |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
// Support for File Entity. |
|
48 |
if (isset($theme_registry['file_entity'])) { |
|
49 |
$theme_registry['file_entity']['preprocess functions'][] = 'ds_test_entity_variables'; |
|
50 |
} |
|
51 |
|
|
52 |
// Support for Entity API. |
|
53 |
if (isset($theme_registry['entity'])) { |
|
54 |
$theme_registry['entity']['preprocess functions'][] = 'ds_test_entity_variables'; |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Theming function, added after ds_entity_variables(). |
|
60 |
* |
|
61 |
* @param $variables |
|
62 |
*/ |
|
63 |
function ds_test_entity_variables(&$variables) { |
|
64 |
if (isset($_GET['store'])) { |
|
65 |
cache_set('ds_test', $variables); |
|
66 |
} |
|
67 |
} |
|
68 |
|
|
27 | 69 |
/** |
28 | 70 |
* Implements hook_views_api(). |
29 | 71 |
*/ |
Formats disponibles : Unified diff
Weekly update of contrib modules