public function global_filter_plugin_argument_default_global_filter_view::get_argument in Views Global Filter 7
Same name and namespace in other branches
- 8 views/global_filter_plugin_argument_default_global_filter_view.inc \global_filter_plugin_argument_default_global_filter_view::get_argument()
- 6 views/global_filter_plugin_argument_default_global_filter_view.inc \global_filter_plugin_argument_default_global_filter_view::get_argument()
Get argument.
Overrides views_plugin_argument_default::get_argument
File
- views/
global_filter_plugin_argument_default_global_filter_view.inc, line 47 - Contains the Global Filter default argument plugin (view).
Class
- global_filter_plugin_argument_default_global_filter_view
- Default argument plugin to extract the View filter values set for this contextual filter.
Code
public function get_argument() {
$arg = $view_names = $this->options['global_filter_view'];
if (!empty($view_names)) {
if (!is_array($view_names)) {
$view_names = array(
$view_names,
);
}
$arg = array();
foreach ($view_names as $view_name) {
$value = global_filter_get_session_value($view_name);
if (isset($value)) {
if (is_array($value)) {
$arg = array_merge($arg, $value);
}
else {
$arg[] = $value;
}
}
}
$arg = array_filter($arg);
}
if (empty($arg)) {
$arg = $this->argument->options['exception']['value'];
}
// If the argument is multi-valued, i.e. multi-select box or check boxes,
// string the values together separated by plus-signs.
// Note this requires the user to tick "Allow multiple values" after
// expanding the "More" fieldset on the Contextual Filter configuration
// panel. Otherwise only the first of the values will used.
$is_and = !empty($this->argument->options['break_phrase']) && !empty($this->options['break_phrase_and']);
return is_array($arg) ? implode($is_and ? ',' : '+', $arg) : $arg;
}