class flag_handler_relationship_counts in Flag 6.2
Same name and namespace in other branches
- 6 includes/flag_handler_relationships.inc \flag_handler_relationship_counts
- 7.3 includes/views/flag_handler_relationships.inc \flag_handler_relationship_counts
- 7.2 includes/flag_handler_relationships.inc \flag_handler_relationship_counts
Specialized relationship handler associating flag counts and content.
Hierarchy
- class \flag_handler_relationship extends \views_handler_relationship
Expanded class hierarchy of flag_handler_relationship_counts
1 string reference to 'flag_handler_relationship_counts'
- flag_views_data_alter in includes/
flag.views.inc - Implements hook_views_data_alter().
File
- includes/
flag_handler_relationships.inc, line 178 - Contains various relationship handlers.
View source
class flag_handler_relationship_counts extends flag_handler_relationship {
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$content_type = $this->definition['flag type'];
$form['flag'] = flag_views_flag_config_form('radios', $content_type, $this->options['flag']);
$form['required']['#title'] = t('Include only flagged content');
$form['required']['#description'] = t('If checked, only content that is flagged will be included.');
}
function admin_summary() {
// Nothing to show.
}
function ui_name($short = FALSE) {
// We put the bookmark name in the UI string to save space.
return t('!group: !title counter', array(
'!group' => $this->definition['group'],
'!title' => $this->options['flag'],
));
}
/**
* Called to implement a relationship in a query.
*/
function query() {
if (!($flag = $this
->get_flag())) {
return;
}
$this->definition['extra'][] = array(
'field' => 'fid',
'value' => $flag->fid,
'numeric' => TRUE,
);
if (!empty($this->options['required'])) {
// Unfortunately, we may have zeros in our table, so having
// parent::query() do INNER JOIN doesn't suffice. We need to filter these
// zeros out.
// @todo Make sure zero records aren't written in the first place, and
// remove this code.
$this->definition['extra'][] = array(
'field' => 'count',
'operator' => '>',
'value' => '0',
'numeric' => TRUE,
);
}
parent::query();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
flag_handler_relationship:: |
function | Returns the flag object. | ||
flag_handler_relationship:: |
function | |||
flag_handler_relationship:: |
function | Every relationship has a 'flag' option. | 1 | |
flag_handler_relationship:: |
function | Make sure the flag exists. | ||
flag_handler_relationship_counts:: |
function | |||
flag_handler_relationship_counts:: |
function | |||
flag_handler_relationship_counts:: |
function | Called to implement a relationship in a query. | ||
flag_handler_relationship_counts:: |
function |