diff --git a/handlers/views_handler_filter.inc b/handlers/views_handler_filter.inc index f9b0a10..3f1556b 100644 --- a/handlers/views_handler_filter.inc +++ b/handlers/views_handler_filter.inc @@ -60,6 +60,7 @@ class views_handler_filter extends views_handler { $options['operator'] = array('default' => '='); $options['value'] = array('default' => ''); + $options['argument_value'] = array('default' => ''); $options['group'] = array('default' => '0'); $options['exposed'] = array('default' => FALSE); $options['expose'] = array( @@ -190,6 +191,19 @@ class views_handler_filter extends views_handler { $form['value']['#prefix'] = '
' . (isset($form['value']['#prefix']) ? $form['value']['#prefix'] : ''); $form['value']['#suffix'] = (isset($form['value']['#suffix']) ? $form['value']['#suffix'] : '') . '
'; } + $form['value']['#dependency'] = array( + 'edit-options-argument-value' => array(''), + ); + $options = array('' => t('None')); + foreach ($this->view->display_handler->get_handlers('argument') as $id => $argument) { + $options[$id] = $argument->ui_name(TRUE); + } + $form['argument_value'] = array( + '#type' => 'select', + '#title' => t('Select value from argument.'), + '#options' => $options, + '#default_value' => $this->options['argument_value'], + ); } /** @@ -572,6 +586,16 @@ class views_handler_filter extends views_handler { } /** + * If pulling arguments from the filter is set, set $this->value here. + */ + function pre_query() { + if (!empty($this->options['argument_value'])) { + $argument = $this->view->argument[$this->options['argument_value']]; + $this->value = $argument->get_value(); + } + } + + /** * Add this filter to the query. * * Due to the nature of fapi, the value and the operator have an unintended