This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = Views Flag Context | |
description = Provides a flag context. | |
core = 7.x | |
package = Flags | |
version = 7.x-0.1 | |
dependencies[] = flag | |
files[] = handlers/views_argument_default_flag.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_views_api(). | |
*/ | |
function views_flag_context_views_api() { | |
return array( | |
'api' => '3', | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_views_plugins(). | |
*/ | |
function views_flag_context_views_plugins() { | |
$plugin = array( | |
'argument default' => array( | |
'views_argument_default_flag' => array( | |
'title' => t('Default Flags'), | |
'handler' => 'views_argument_default_flag', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Define the options form to enable selection of flags. | |
*/ | |
function options_form(&$form, &$form_state) { | |
} | |
/** | |
* Return all possible options for the view and provide default values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
'#default_value' => $this->options['flags'], | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Define the options form to enable selection of flags. | |
*/ | |
function options_form(&$form, &$form_state) { | |
// Load all flags and types of each flag. | |
$flags = flag_get_flags('taxonomy_term'); | |
// Combine all types (=vocabs) into one option array. | |
$flag_types = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Return all possible options for the view and provide default values. | |
*/ | |
function option_definition() { | |
$options = parent::option_definition(); | |
$options['flags'] = array('default' => array()); | |
$options['vocabularies'] = array('default' => array()); | |
$options['fallback'] = array('default' => 'all'); | |
$options['multiple_operator'] = array('default' => '+'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Provide the default form form for submitting options. | |
*/ | |
function options_submit(&$form, &$form_state, &$options = array()) { | |
// We filter the options on only selected ones. | |
$options['flags'] = array_filter($options['flags']); | |
$options['vocabularies'] = array_filter($options['vocabularies']); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This function controls what to return to the contextual filter. | |
*/ | |
function get_argument() { | |
// Get available flag types from the system. | |
$flags = flag_get_flags('taxonomy_term'); | |
// Get all User flags. | |
$user_flags = flag_get_user_flags('taxonomy_term'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Helper to filter tids on given vocabularies. | |
* | |
* @param array $tids | |
* array of term ids | |
* @param array $vocabularies | |
* array of vocabulary machine names | |
* | |
* @return array |
OlderNewer