forked from NCSU-Libraries/ncsulib_foundation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfields.inc
More file actions
executable file
·69 lines (53 loc) · 1.99 KB
/
fields.inc
File metadata and controls
executable file
·69 lines (53 loc) · 1.99 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
include 'controllers/spaces.php';
include 'controllers/events.php';
// include 'controllers/workshops.php';
include 'controllers/news.php';
include 'controllers/users.php';
include 'controllers/library_stories.php';
include 'controllers/devices.php';
/** GLOBALS **/
/**
* Implements theme_field()
*
* Just to get rid of stupid colons
*/
function ncsulib_foundation_field($variables) {
$output = '';
// Render the label, if it's not hidden.
if (!$variables['label_hidden']) {
$output .= '<h2 class="field-label"' . $variables['title_attributes'] . '>' . $variables['label'] . '</h2>';
}
// Render the items.
$output .= '<div class="field-items"' . $variables['content_attributes'] . '>';
foreach ($variables['items'] as $delta => $item) {
$classes = 'field-item ' . ($delta % 2 ? 'odd' : 'even');
$output .= '<div class="' . $classes . '"' . $variables['item_attributes'][$delta] . '>' . drupal_render($item) . '</div>';
}
$output .= '</div>';
// Render the top-level DIV.
$output = '<div class="' . $variables['classes'] . '"' . $variables['attributes'] . '>' . $output . '</div>';
return $output;
}
/**
* Implements theme_field()
*
* Turns all entity reference fields into a clean ul
*/
function ncsulib_foundation_field__entityreference($variables) {
$output = '';
// Render the label, if it's not hidden.
if (!$variables['label_hidden']) {
$output .= '<h2 class="field-label"' . $variables['title_attributes'] . '>' . $variables['label'] . '</h2>';
}
// Render the items.
$output .= '<ul class="field-items"' . $variables['content_attributes'] . '>';
foreach ($variables['items'] as $delta => $item) {
$classes = 'field-item ';
$output .= '<li class="' . $classes . '"' . $variables['item_attributes'][$delta] . '>' . drupal_render($item) . '</li>';
}
$output .= '</ul>';
// Render the top-level DIV.
$output = '<div class="' . $variables['classes'] . '"' . $variables['attributes'] . '>' . $output . '</div>';
return $output;
}