function flag_handler_relationship_content::query in Flag 7.3
Same name and namespace in other branches
- 6.2 includes/flag_handler_relationships.inc \flag_handler_relationship_content::query()
- 6 includes/flag_handler_relationships.inc \flag_handler_relationship_content::query()
- 7.2 includes/flag_handler_relationships.inc \flag_handler_relationship_content::query()
Called to implement a relationship in a query.
Overrides views_handler_relationship::query
File
- includes/
views/ flag_handler_relationships.inc, line 156 - Contains various relationship handlers.
Class
- flag_handler_relationship_content
- Views relationship handler associating flags and content.
Code
function query() {
if (!($flag = $this
->get_flag())) {
return;
}
$this->definition['extra'][] = array(
'field' => 'fid',
'value' => $flag->fid,
'numeric' => TRUE,
);
if ($this->options['user_scope'] == 'current' && !$flag->global) {
$this->definition['extra'][] = array(
'field' => 'uid',
'value' => '***CURRENT_USER***',
'numeric' => TRUE,
);
$flag_roles = user_roles(FALSE, "flag {$flag->name}");
if (isset($flag_roles[DRUPAL_ANONYMOUS_RID])) {
// Disable page caching for anonymous users.
drupal_page_is_cacheable(FALSE);
// Add in the SID from Session API for anonymous users.
$this->definition['extra'][] = array(
'field' => 'sid',
'value' => '***FLAG_CURRENT_USER_SID***',
'numeric' => TRUE,
);
}
}
parent::query();
}