This repository has been archived by the owner on Jun 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemplate.php
86 lines (71 loc) · 2.72 KB
/
template.php
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* @file
* Theme functions
*/
// Include all files from the includes directory.
$includes_path = dirname(__FILE__) . '/includes/*.inc';
foreach (glob($includes_path) as $filename) {
require_once dirname(__FILE__) . '/includes/' . basename($filename);
}
function ipbes_new_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['search_api_views_fulltext'])) {
$form['search_api_views_fulltext']['#attributes']['placeholder'] = t('Enter search terms');
}
if (isset($form['combine'])) {
$form['combine']['#attributes']['placeholder'] = t('Enter search terms');}
}
function ipbes_new_preprocess_views_exposed_form(&$vars, $hook) {
// Change the text on the submit button
$vars['form']['submit']['#value'] = t('Search');
// Rebuild the rendered version (submit button, rest remains unchanged)
unset($vars['form']['submit']['#printed']);
$vars['button'] = drupal_render($vars['form']['submit']);
}
// Add permalink to comments
function ipbes_new_preprocess_comment(&$variables){
/* Easy links to the comment and parent node */
$comment = $variables['comment'];
$node = node_load($comment->nid);
$variables['first_post'] = $node;
// Set the post ID for theming / targetting
$variables['post_id'] = "post-$comment->cid";
/* Linked post number */
if (!isset($post_number)) {
static $post_number = 1;
}
$posts_per_page = variable_get('comment_default_per_page_' . $node->type, 50);
$page_number = !empty($_GET['page']) ? $_GET['page'] : 0;
if (!$page_number) {
$page_number = 0;
}
$post_number++;
$linktext = '#' . (($page_number * $posts_per_page) + $post_number);
// Permalink
// You can erase next 3 lines if you wish to use built-in Permalink.
// Template adjusted: $post_link -> $permalink
$uri = entity_uri('comment', $comment);
$uri['options'] += array('attributes' => array('class' => 'permalink', 'rel' => 'bookmark'));
$variables['permalink'] = l($linktext, $uri['path'], $uri['options']);
}
function ipbes_new_preprocess_page(&$variables) {
$path = current_path();
$aliaspath = drupal_get_path_alias();
$alias = explode("/", $aliaspath);
if(($alias['0'] == "group" && $alias[1] == "onet") ||
($aliaspath == "eform/submit/organization-signup") ||
($aliaspath == "eform/submit/open-ended-stakeholder-network") ||
($aliaspath == "forum/onet-forum")) {
// echo "here";die;
$variables['theme_hook_suggestions'][] = 'page__grouponet';
}
}
function ipbes_new_preprocess_node(&$variables) {
$path = current_path();
$aliaspath = drupal_get_path_alias();
$alias = explode("/", $aliaspath);
if($alias['0'] == "group" && $alias[1] == "onet") {
$variables['theme_hook_suggestions'][] = 'node__12025';
}
}
?>