Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/search/views_handler_field_search_score.inc | ||
---|---|---|
11 | 11 |
* @ingroup views_field_handlers |
12 | 12 |
*/ |
13 | 13 |
class views_handler_field_search_score extends views_handler_field_numeric { |
14 |
function option_definition() { |
|
14 |
|
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function option_definition() { |
|
15 | 19 |
$options = parent::option_definition(); |
16 | 20 |
|
17 | 21 |
$options['alternate_sort'] = array('default' => ''); |
... | ... | |
20 | 24 |
return $options; |
21 | 25 |
} |
22 | 26 |
|
23 |
function options_form(&$form, &$form_state) { |
|
27 |
/** |
|
28 |
* {@inheritdoc} |
|
29 |
*/ |
|
30 |
public function options_form(&$form, &$form_state) { |
|
24 | 31 |
$style_options = $this->view->display_handler->get_option('style_options'); |
25 | 32 |
if (isset($style_options['default']) && $style_options['default'] == $this->options['id']) { |
26 | 33 |
$handlers = $this->view->display_handler->get_handlers('field'); |
... | ... | |
48 | 55 |
parent::options_form($form, $form_state); |
49 | 56 |
} |
50 | 57 |
|
51 |
function query() { |
|
58 |
/** |
|
59 |
* {@inheritdoc} |
|
60 |
*/ |
|
61 |
public function query() { |
|
52 | 62 |
// Check to see if the search filter added 'score' to the table. |
53 | 63 |
// Our filter stores it as $handler->search_score -- and we also |
54 | 64 |
// need to check its relationship to make sure that we're using the same |
... | ... | |
65 | 75 |
$this->options['exclude'] = TRUE; |
66 | 76 |
if (!empty($this->options['alternate_sort'])) { |
67 | 77 |
if (isset($this->view->style_plugin->options['default']) && $this->view->style_plugin->options['default'] == $this->options['id']) { |
68 |
// Since the style handler initiates fields, we plug these values right into the active handler. |
|
78 |
// Since the style handler initiates fields, we plug these values right |
|
79 |
// into the active handler. |
|
69 | 80 |
$this->view->style_plugin->options['default'] = $this->options['alternate_sort']; |
70 | 81 |
$this->view->style_plugin->options['order'] = $this->options['alternate_order']; |
71 | 82 |
} |
72 | 83 |
} |
73 | 84 |
} |
74 | 85 |
|
75 |
function render($values) { |
|
86 |
/** |
|
87 |
* {@inheritdoc} |
|
88 |
*/ |
|
89 |
public function render($values) { |
|
76 | 90 |
// Only render if we exist. |
77 | 91 |
if (isset($this->table_alias)) { |
78 | 92 |
return parent::render($values); |
79 | 93 |
} |
80 | 94 |
} |
95 |
|
|
81 | 96 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules