|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Implements template_preprocess_html(). |
|
5
|
|
|
* |
|
6
|
|
|
*/ |
|
7
|
|
|
//function bbc_preprocess_html(&$variables) { |
|
|
|
|
|
|
8
|
|
|
// // Add conditional CSS for IE. To use uncomment below and add IE css file |
|
9
|
|
|
// drupal_add_css(path_to_theme() . '/css/ie.css', array('weight' => CSS_THEME, 'browsers' => array('!IE' => FALSE), 'preprocess' => FALSE)); |
|
10
|
|
|
// |
|
11
|
|
|
// // Need legacy support for IE downgrade to Foundation 2 or use JS file below |
|
12
|
|
|
// // drupal_add_js('http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE7.js', 'external'); |
|
13
|
|
|
//} |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Implements template_preprocess_page |
|
17
|
|
|
* |
|
18
|
|
|
*/ |
|
19
|
|
|
//function bbc_preprocess_page(&$variables) { |
|
|
|
|
|
|
20
|
|
|
//} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Implements template_preprocess_node |
|
24
|
|
|
* |
|
25
|
|
|
*/ |
|
26
|
|
|
//function bbc_preprocess_node(&$variables) { |
|
|
|
|
|
|
27
|
|
|
//} |
|
28
|
|
|
|
|
29
|
|
|
function med_form_alter(&$form, &$form_state, $form_id) { |
|
|
|
|
|
|
30
|
|
|
if ($form_id == 'search_block_form') { |
|
31
|
|
|
$form['search_block_form']['#title'] = t('Search'); // Change the text on the label element |
|
32
|
|
|
$form['search_block_form']['#title_display'] = 'invisible'; // Toggle label visibilty |
|
33
|
|
|
$form['search_block_form']['#size'] = 40; // define size of the textfield |
|
34
|
|
|
$form['search_block_form']['#default_value'] = t('Search'); // Set a default value for the textfield |
|
35
|
|
|
$form['actions']['submit']['#value'] = t('GO!'); // Change the text on the submit button |
|
36
|
|
|
$form['actions']['submit'] = array('#type' => 'image_button', '#src' => base_path() . path_to_theme() . '/images/search-button.png'); |
|
37
|
|
|
// Add extra attributes to the text box |
|
38
|
|
|
$form['search_block_form']['#attributes']['onblur'] = "if (this.value == '') {this.value = 'Search';}"; |
|
39
|
|
|
$form['search_block_form']['#attributes']['onfocus'] = "if (this.value == 'Search') {this.value = '';}"; |
|
40
|
|
|
// Prevent user from searching the default text |
|
41
|
|
|
$form['#attributes']['onsubmit'] = "if(this.search_block_form.value=='Search'){ alert('Please enter a search'); return false; }"; |
|
42
|
|
|
// Alternative (HTML5) placeholder attribute instead of using the javascript |
|
43
|
|
|
$form['search_block_form']['#attributes']['placeholder'] = t('Search'); |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Implements hook_preprocess_page(). |
|
49
|
|
|
* |
|
50
|
|
|
* Adds jQuery.mmenu to every page load. |
|
51
|
|
|
*/ |
|
52
|
|
|
function med_preprocess_page(&$variables) { |
|
|
|
|
|
|
53
|
|
|
if (module_exists('libraries')) { |
|
54
|
|
|
// Get the jQuery.mmenu library path. |
|
55
|
|
|
$library_exists = libraries_detect('jQuery.mmenu'); |
|
56
|
|
|
|
|
57
|
|
|
// Check that all of our requirements are met before proceeding. |
|
58
|
|
|
if ($library_exists) { |
|
59
|
|
|
// Load the jQuery.mmenu library. |
|
60
|
|
|
libraries_load('jQuery.mmenu'); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.