-
Notifications
You must be signed in to change notification settings - Fork 0
/
iondry.module
51 lines (40 loc) · 1.65 KB
/
iondry.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
40
41
42
43
44
45
46
47
48
49
50
51
<?php
require_once 'iondry.block.inc';
require_once 'iondry.node.inc';
require_once 'iondry.term.inc';
require_once 'iondry.file.inc';
require_once 'iondry.view.inc';
require_once 'iondry.inc';
function iondry_preprocess_node(&$vars) {
$node = $vars['node'];
$vars['attributes_array']['id'] = 'node-'.$node->nid;
//theme hook suggestion based on view mode & type in combination
$vars['theme_hook_suggestions'][] = 'node__' . $vars['view_mode'];
$vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode'];
}
function iondry_preprocess_field(&$vars) {
$element = $vars['element'];
//add .prose to all type text_long/texteditor
if(in_array($element['#field_type'], array('text_with_summary','text_long'))) {
$vars['classes_array'][] = 'prose';
}
//theme hook suggestion based on view mode & type in combination
$vars['theme_hook_suggestions'][] = 'field__' . $element['#field_name'] . '__' . $element['#bundle'] . '__' . $element['#view_mode'];
}
function _iondry_render_block_content($module, $delta) {
$block = block_load($module,$delta);
$renderable_block= _block_get_renderable_array(_block_render_blocks(array($block)));
return drupal_render($renderable_block);
//old version:
$output = '';
if ($block = block_load($module, $delta)) {
if ($build = module_invoke($module, 'block_view', $delta)) {
$delta = str_replace('-', '_', $delta);
drupal_alter(array('block_view', "block_view_{$module}_{$delta}"), $build, $block);
if (!empty($build['content'])) {
return is_array($build['content']) ? render($build['content']) : $build['content'];
}
}
}
return $output;
}