Skip to content
Snippets Groups Projects
Commit a935757c authored by Sam Boyer's avatar Sam Boyer
Browse files

Really, really dumb idea to use quiz_node_properties.nid as the views 'real...

Really, really dumb idea to use quiz_node_properties.nid as the views 'real field' for quiz_node_properties.vid.
parent 87831813
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,11 @@ class quiz_views_handler_argument_quiz_nid extends views_handler_argument_numeri
var $corresponding_vids = array();
var $phrase_broken = FALSE;
function construct() {
parent::construct();
$this->nid_field = $this->definition['nid field'];
}
function option_definition() {
$options = parent::option_definition();
......@@ -63,10 +68,10 @@ class quiz_views_handler_argument_quiz_nid extends views_handler_argument_numeri
// Do subselect to get relevant vids, then add where clause
if ($this->subselect_vids()) {
$placeholders = implode(', ', array_fill(0, count($this->corresponding_vids), '%d'));
$this->query->add_where(0, "$this->table_alias.$this->real_field IN ($placeholders)", $this->corresponding_vids);
$this->query->add_where(0, "$this->table_alias.$this->nid_field IN ($placeholders)", $this->corresponding_vids);
}
else {
$this->query->add_where(0, "$this->table_alias.$this->real_field = %d", $this->corresponding_vids);
$this->query->add_where(0, "$this->table_alias.$this->nid_field = %d", $this->corresponding_vids);
}
}
......
......@@ -80,6 +80,11 @@ function quiz_views_data() {
'field' => 'nid',
'type' => 'INNER',
),
'node_revisions' => array(
'left_field' => 'vid',
'field' => 'vid',
'type' => 'INNER',
),
),
),
......@@ -106,7 +111,6 @@ function quiz_views_data() {
),
),
'nid' => array(
'real field' => 'vid',
'title' => t('Quiz Node NID'),
'help' => t('The ID of the Quiz Node.'),
'field' => array(
......@@ -116,13 +120,15 @@ function quiz_views_data() {
'argument' => array(
'handler' => 'quiz_views_handler_argument_quiz_nid',
'name field' => 'title',
'name table' => 'node',
'name table' => 'node_revisions',
'numeric' => TRUE,
'validate type' => 'vid',
'nid field' => 'nid',
),
'filter' => array(
'handler' => 'quiz_views_handler_filter_quiz_nid',
'help' => t('Filter results to a particular subset of quiz versions.'),
'title' => t('Quiz Version'),
'help' => t('Filter results to a specific subset of quiz versions.'),
'group by' => 'vid',
// 'secondary group by' => 'vid',
),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment