Révision 76e2e7c3
Ajouté par Assos Assos il y a environ 10 ans
drupal7/sites/all/modules/flag/includes/views/flag_plugin_argument_validate_flaggability.inc | ||
---|---|---|
66 | 66 |
} |
67 | 67 |
|
68 | 68 |
/** |
69 |
* Returns form #options for the flags. Returns empty array if no flags were |
|
70 |
* found. |
|
69 |
* Returns form #options for the flags. |
|
70 |
* |
|
71 |
* Returns empty array if no flags were found. |
|
71 | 72 |
*/ |
72 | 73 |
function flags_options() { |
73 | 74 |
$flags = flag_get_flags($this->flag_type); |
... | ... | |
96 | 97 |
} |
97 | 98 |
|
98 | 99 |
/** |
99 |
* Declares all tests. This scheme makes it easy for derived classes to add |
|
100 |
* and remove tests. |
|
100 |
* Declares all tests. |
|
101 |
* |
|
102 |
* This scheme makes it easy for derived classes to add and remove tests. |
|
101 | 103 |
*/ |
102 | 104 |
function tests_info($which = NULL) { |
103 | 105 |
return array( |
... | ... | |
130 | 132 |
if ($flag_name == '*relationship*') { |
131 | 133 |
// Pick the first flag mentioned in the relationships. |
132 | 134 |
foreach ($this->view->relationship as $id => $handler) { |
133 |
// Note: we can't do $handler->field, because the relationship handler's init() may overwrite it. |
|
135 |
// Note: we can't do $handler->field, because the relationship handler's |
|
136 |
// init() may overwrite it. |
|
134 | 137 |
if (strpos($handler->options['field'], 'flag') !== FALSE && !empty($handler->options['flag'])) { |
135 | 138 |
$flag = flag_get_flag($handler->options['flag']); |
136 | 139 |
if ($flag && $flag->entity_type == $this->flag_type) { |
... | ... | |
198 | 201 |
} |
199 | 202 |
|
200 | 203 |
function test_flagged($ids, $flag) { |
201 |
// view_break_phrase() is guaranteed to return only integers, so this is SQL safe. |
|
204 |
// view_break_phrase() is guaranteed to return only integers, so this is SQL |
|
205 |
// safe. |
|
202 | 206 |
$flattened_ids = implode(',', $ids); |
203 | 207 |
return $this->_test_by_sql("SELECT entity_id FROM {flag_counts} WHERE fid = :fid AND entity_id IN ($flattened_ids) AND count > 0", array(':fid' => $flag->fid)); |
204 | 208 |
} |
... | ... | |
206 | 210 |
function test_flagged_by_current_user($ids, $flag) { |
207 | 211 |
global $user; |
208 | 212 |
if (!$user->uid) { |
209 |
// Anonymous user |
|
213 |
// Anonymous user.
|
|
210 | 214 |
return array(); |
211 | 215 |
} |
212 | 216 |
$flattened_ids = implode(',', $ids); |
... | ... | |
223 | 227 |
return $passed; |
224 | 228 |
} |
225 | 229 |
} |
226 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules