1 | <?php |
||
2 | // $id$ |
||
3 | |||
4 | /** |
||
5 | * @file |
||
6 | * Module contains boinc-related customizations for apache solr |
||
7 | * search. |
||
8 | */ |
||
9 | |||
10 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
||
11 | * Hooks into drupal |
||
12 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
||
13 | |||
14 | /** |
||
15 | * Implementation of hook_block() |
||
16 | * |
||
17 | * Functions are forward compatible with Drupal 7 hooks. |
||
18 | */ |
||
19 | function boinc_solr_search_block($op = 'list', $delta = 0, $edit = array()) { |
||
20 | switch ($op) { |
||
21 | case 'list': |
||
22 | return boinc_solr_search_block_info(); |
||
23 | break; |
||
0 ignored issues
–
show
|
|||
24 | case 'view': |
||
25 | return boinc_solr_search_block_view($delta); |
||
26 | break; |
||
27 | case 'configure': |
||
28 | case 'save': |
||
29 | default: |
||
30 | } |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Implementation of hook_block_info() |
||
35 | * |
||
36 | * This is a Drupal 7 hook, which will allow this module to be |
||
37 | * (somewhat) forward compatible. |
||
38 | */ |
||
39 | function boinc_solr_search_block_info() { |
||
40 | $blocks = array(); |
||
41 | $blocks['boinc_solr_search_0'] = array( |
||
42 | 'info' => t('BOINC Search Help'), |
||
43 | ); |
||
44 | return $blocks; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Implementation of hook_block_view() |
||
49 | * |
||
50 | * This is a Drupal 7 hook, which will allow this module to be |
||
51 | * (somewhat) forward compatible. |
||
52 | */ |
||
53 | function boinc_solr_search_block_view($delta = 0) { |
||
54 | $block = array(); |
||
55 | switch($delta) { |
||
56 | case 'boinc_solr_search_0': |
||
57 | $items = array( |
||
58 | bts('By default a search matches ANY search term. Results with more than one term will be presented higher in the search results.', array(), NULL, 'boinc:search-help-sidebar-block'), |
||
59 | bts('You may use \'AND\' to have the search engine return results with ALL search terms.', array(), NULL, 'boinc:search-help-sidebar-block'), |
||
60 | bts('For example, searching for \'boinc AND client\' will only contain results with words boinc and client.', array(), NULL, 'boinc:search-help-sidebar-block') |
||
61 | ); |
||
62 | |||
63 | drupal_add_js('misc/collapse.js'); |
||
64 | // For Drupal 7 the format of the array changes, see https://api.drupal.org/api/drupal/includes%21form.inc/function/theme_fieldset/7.x for details. |
||
65 | $collapsible_item = array( |
||
66 | '#title' => bts('Search Help', array(), NULL, 'boinc:search-help-sidebar-block'), |
||
67 | '#description' => theme_item_list($items), |
||
68 | '#collapsible' => TRUE, |
||
69 | '#collapsed' => TRUE, |
||
70 | '#attributes' => array( |
||
71 | 'class' => 'search-help-block', |
||
72 | ), |
||
73 | ); |
||
74 | $block['content'] = theme('fieldset', $collapsible_item); |
||
75 | break; |
||
76 | } |
||
77 | return $block; |
||
78 | } |
||
79 |
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.