Object used to create a SELECT query. More...
Public Member Functions | |
init ($base_table= 'node', $base_field= 'nid', $options) | |
Constructor; Create the basic query object and fill with default values. | |
set_distinct ($value=TRUE) | |
Set the base field to be distinct. | |
set_count_field ($table, $field, $alias=NULL) | |
Set what field the query will count() on for paging. | |
set_header ($header) | |
Set the table header; used for click-sorting because it's needed info to modify the ORDER BY clause. | |
option_definition () | |
Information about options for all kinds of purposes will be held here. | |
options_form (&$form, &$form_state) | |
Add settings for the ui. | |
add_relationship ($alias, $join, $base, $link_point=NULL) | |
A relationship is an alternative endpoint to a series of table joins. | |
add_table ($table, $relationship=NULL, $join=NULL, $alias=NULL) | |
Add a table to the query, ensuring the path exists. | |
queue_table ($table, $relationship=NULL, $join=NULL, $alias=NULL) | |
Add a table to the query without ensuring the path. | |
mark_table ($table, $relationship, $alias) | |
ensure_table ($table, $relationship=NULL, $join=NULL) | |
Ensure a table exists in the queue; if it already exists it won't do anything, but if it doesn't it will add the table queue. | |
ensure_path ($table, $relationship=NULL, $join=NULL, $traced=array(), $add=array()) | |
Make sure that the specified table can be properly linked to the primary table in the JOINs. | |
adjust_join ($join, $relationship) | |
Fix a join to adhere to the proper relationship; the left table can vary based upon what relationship items are joined in on. | |
get_join_data ($table, $base_table) | |
Retrieve join data from the larger join data cache. | |
get_table_info ($table) | |
Get the information associated with a table. | |
add_field ($table, $field, $alias= '', $params=array()) | |
Add a field to the query table, possibly with an alias. | |
clear_fields () | |
Remove all fields that may've been added; primarily used for summary mode where we're changing the query because we didn't get data we needed. | |
add_where ($group, $field, $value=NULL, $operator=NULL) | |
Add a simple WHERE clause to the query. | |
add_where_expression ($group, $snippet, $args=array()) | |
Add a complex WHERE clause to the query. | |
add_having ($group, $field, $value=NULL, $operator=NULL) | |
Add a simple HAVING clause to the query. | |
add_having_expression ($group, $snippet, $args=array()) | |
Add a complex HAVING clause to the query. | |
add_orderby ($table, $field=NULL, $order= 'ASC', $alias= '', $params=array()) | |
Add an ORDER BY clause to the query. | |
add_groupby ($clause) | |
Add a simple GROUP BY clause to the query. | |
get_field_alias ($table_alias, $field) | |
Returns the alias for the given field added to $table. | |
add_tag ($tag) | |
Adds a query tag to the sql object. | |
placeholder ($base= 'views') | |
Generates a unique placeholder used in the db query. | |
build_condition ($where= 'where') | |
Construct the "WHERE" or "HAVING" part of the query. | |
compile_fields ($fields_array, $query) | |
Build fields array. | |
query ($get_count=FALSE) | |
Generate a query and a countquery from all of the information supplied to the object. | |
get_where_args () | |
Get the arguments attached to the WHERE and HAVING clauses of this query. | |
alter (&$view) | |
Let modules modify the query just prior to finalizing it. | |
build (&$view) | |
Builds the necessary info to execute the query. | |
execute (&$view) | |
Executes the query and fills the associated view object with according values. | |
add_signature (&$view) | |
Add a signature to the query, if such a thing is feasible. | |
get_aggregation_info () | |
Get aggregation info for group by queries. | |
get_result_entities ($results, $relationship=NULL) | |
Returns the according entity objects for the given query results. | |
query () | |
Add anything to the query that we might need to. | |
options_validate (&$form, &$form_state) | |
Validate the options form. | |
options_submit (&$form, &$form_state) | |
Handle any special handling on the validate form. | |
summary_title () | |
Returns the summary of the settings in the display. | |
set_limit ($limit) | |
Set a LIMIT on the query, specifying a maximum number of results. | |
set_offset ($offset) | |
Set an OFFSET on the query, specifying a number of results to skip. | |
render_pager ($exposed_input) | |
Render the pager, if necessary. | |
set_where_group ($type= 'AND', $group=NULL, $where= 'where') | |
Create a new grouping for the WHERE or HAVING clause. | |
set_group_operator ($type= 'AND') | |
Control how all WHERE and HAVING groups are put together. | |
theme_functions () | |
Provide a full list of possible theme templates used by this style. | |
additional_theme_functions () | |
Provide a list of additional theme functions for the theme information page. | |
validate () | |
Validate that the plugin is correct and can be saved. | |
plugin_title () | |
Return the human readable name of the display. | |
construct () | |
Views handlers use a special construct function so that we can more easily construct them with variable arguments. | |
options (&$options) | |
Set default options on this object. | |
set_default_options () | |
Set default options. | |
_set_option_defaults (&$storage, $options, $level=0) | |
unpack_options (&$storage, $options, $definition=NULL, $all=TRUE, $check=TRUE, $localization_keys=array()) | |
Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. | |
set_definition ($definition) | |
Let the handler know what its full definition is. | |
destroy () | |
export_options ($indent, $prefix) | |
export_option ($indent, $prefix, $storage, $option, $definition, $parents) | |
unpack_translatables (&$translatable, $parents=array()) | |
Unpacks each handler to store translatable texts. | |
unpack_translatable (&$translatable, $storage, $option, $definition, $parents, $keys=array()) | |
Unpack a single option definition. | |
Public Attributes | |
$table_queue = array() | |
A list of tables in the order they should be added, keyed by alias. | |
$tables = array() | |
Holds an array of tables and counts added so that we can create aliases. | |
$relationships = array() | |
Holds an array of relationships, which are aliases of the primary table that represent different ways to join the same table in. | |
$where = array() | |
An array of sections of the WHERE query. | |
$having = array() | |
An array of sections of the HAVING query. | |
$group_operator = 'AND' | |
The default operator to use when connecting the WHERE groups. | |
$orderby = array() | |
A simple array of order by clauses. | |
$groupby = array() | |
A simple array of group by clauses. | |
$header = array() | |
The table header to use for tablesort. | |
$distinct = FALSE | |
A flag as to whether or not to make the primary field distinct. | |
$has_aggregate = FALSE | |
$get_count_optimized = NULL | |
Should this query be optimized for counts, for example no sorts. | |
$pager = NULL | |
A pager plugin that should be provided by the display. | |
$field_aliases = array() | |
An array mapping table aliases and field names to field aliases. | |
$tags = array() | |
Query tags which will be passed over to the dbtng query object. | |
$view = NULL | |
$display = NULL | |
$plugin_type = NULL | |
The plugin type of this plugin, for example style or query. | |
$options = array() | |
Except for displays, options for the object will be held here. | |
$definition |
Object used to create a SELECT query.
Definition at line 11 of file views_plugin_query_default.inc.
views_plugin_query_default::add_field | ( | $ | table, | |
$ | field, | |||
$ | alias = '' , |
|||
$ | params = array() | |||
) |
Add a field to the query table, possibly with an alias.
This will automatically call ensure_table to make sure the required table exists, *unless* $table is unset.
$table | The table this field is attached to. If NULL, it is assumed this will be a formula; otherwise, ensure_table is used to make sure the table exists. | |
$field | The name of the field to add. This may be a real field or a formula. | |
$alias | The alias to create. If not specified, the alias will be $table_$field unless $table is NULL. When adding formulae, it is recommended that an alias be used. | |
$params | An array of parameters additional to the field that will control items such as aggregation functions and DISTINCT. |
Definition at line 714 of file views_plugin_query_default.inc.
References ensure_table().
Referenced by add_orderby(), and query().
{ // We check for this specifically because it gets a special alias. if ($table == $this->base_table && $field == $this->base_field && empty($alias)) { $alias = $this->base_field; } if ($table && empty($this->table_queue[$table])) { $this->ensure_table($table); } if (!$alias && $table) { $alias = $table . '_' . $field; } // Make sure an alias is assigned $alias = $alias ? $alias : $field; // PostgreSQL truncates aliases to 63 characters: http://drupal.org/node/571548 // We limit the length of the original alias up to 60 characters // to get a unique alias later if its have duplicates $alias = strtolower(substr($alias, 0, 60)); // Create a field info array. $field_info = array( 'field' => $field, 'table' => $table, 'alias' => $alias, ) + $params; // Test to see if the field is actually the same or not. Due to // differing parameters changing the aggregation function, we need // to do some automatic alias collision detection: $base = $alias; $counter = 0; while (!empty($this->fields[$alias]) && $this->fields[$alias] != $field_info) { $field_info['alias'] = $alias = $base . '_' . ++$counter; } if (empty($this->fields[$alias])) { $this->fields[$alias] = $field_info; } // Keep track of all aliases used. $this->field_aliases[$table][$field] = $alias; return $alias; }
views_plugin_query_default::add_groupby | ( | $ | clause | ) |
Add a simple GROUP BY clause to the query.
The caller is responsible for ensuring that the fields are fully qualified and the table is properly added.
Definition at line 993 of file views_plugin_query_default.inc.
Referenced by query().
{ // Only add it if it's not already in there. if (!in_array($clause, $this->groupby)) { $this->groupby[] = $clause; } }
views_plugin_query_default::add_having | ( | $ | group, | |
$ | field, | |||
$ | value = NULL , |
|||
$ | operator = NULL | |||
) |
Add a simple HAVING clause to the query.
The caller is responsible for ensuring that all fields are fully qualified (TABLE.FIELD) and that the table and an appropriate GROUP BY already exist in the query. Internally the dbtng method "havingCondition" is used.
$group | The HAVING group to add these to; groups are used to create AND/OR sections. Groups cannot be nested. Use 0 as the default group. If the group does not yet exist it will be created as an AND group. | |
$field | The name of the field to check. | |
$value | The value to test the field against. In most cases, this is a scalar. For more complex options, it is an array. The meaning of each element in the array is dependent on the $operator. | |
$operator | The comparison operator, such as =, <, or >=. It also accepts more complex options such as IN, LIKE, or BETWEEN. Defaults to IN if $value is an array = otherwise. If $field is a string you have to use 'formula' here. |
Definition at line 874 of file views_plugin_query_default.inc.
References views_plugin_query::set_where_group().
{ // Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all // the default group. if (empty($group)) { $group = 0; } // Check for a group. if (!isset($this->having[$group])) { $this->set_where_group('AND', $group, 'having'); } // Add the clause and the args. $this->having[$group]['conditions'][] = array( 'field' => $field, 'value' => $value, 'operator' => $operator, ); }
views_plugin_query_default::add_having_expression | ( | $ | group, | |
$ | snippet, | |||
$ | args = array() | |||
) |
Add a complex HAVING clause to the query.
The caller is responsible for ensuring that all fields are fully qualified (TABLE.FIELD) and that the table and an appropriate GROUP BY already exist in the query. Internally the dbtng method "having" is used.
$group | The HAVING group to add these to; groups are used to create AND/OR sections. Groups cannot be nested. Use 0 as the default group. If the group does not yet exist it will be created as an AND group. | |
$snippet | The snippet to check. This can be either a column or a complex expression like "COUNT(table.field) > 3" | |
$args | An associative array of arguments. |
Definition at line 912 of file views_plugin_query_default.inc.
References views_plugin_query::set_where_group().
{ // Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all // the default group. if (empty($group)) { $group = 0; } // Check for a group. if (!isset($this->having[$group])) { $this->set_where_group('AND', $group, 'having'); } // Add the clause and the args. $this->having[$group]['conditions'][] = array( 'field' => $snippet, 'value' => $args, 'operator' => 'formula', ); }
views_plugin_query_default::add_orderby | ( | $ | table, | |
$ | field = NULL , |
|||
$ | order = 'ASC' , |
|||
$ | alias = '' , |
|||
$ | params = array() | |||
) |
Add an ORDER BY clause to the query.
$table | The table this field is part of. If a formula, enter NULL. If you want to orderby random use "rand" as table and nothing else. | |
$field | The field or formula to sort on. If already a field, enter NULL and put in the alias. | |
$order | Either ASC or DESC. | |
$alias | The alias to add the field as. In SQL, all fields in the order by must also be in the SELECT portion. If an $alias isn't specified one will be generated for from the $field; however, if the $field is a formula, this alias will likely fail. | |
$params | Any params that should be passed through to the add_field. |
-- removing, this should be taken care of by field adding now. -- leaving commented because I am unsure. If grouping, all items in the order by must also be in the group by clause. Check $table to ensure that this is not a formula. if ($this->groupby && $table) { $this->add_groupby($as); }
Definition at line 951 of file views_plugin_query_default.inc.
References add_field(), and ensure_table().
{ // Only ensure the table if it's not the special random key. // @todo: Maybe it would make sense to just add a add_orderby_rand or something similar. if ($table && $table != 'rand') { $this->ensure_table($table); } // Only fill out this aliasing if there is a table; // otherwise we assume it is a formula. if (!$alias && $table) { $as = $table . '_' . $field; } else { $as = $alias; } if ($field) { $as = $this->add_field($table, $field, $as, $params); } $this->orderby[] = array( 'field' => $as, 'direction' => strtoupper($order) ); }
views_plugin_query_default::add_relationship | ( | $ | alias, | |
$ | join, | |||
$ | base, | |||
$ | link_point = NULL | |||
) |
A relationship is an alternative endpoint to a series of table joins.
Relationships must be aliases of the primary table and they must join either to the primary table or to a pre-existing relationship.
An example of a relationship would be a nodereference table. If you have a nodereference named 'book_parent' which links to a parent node, you could set up a relationship 'node_book_parent' to 'node'. Then, anything that links to 'node' can link to 'node_book_parent' instead, thus allowing all properties of both nodes to be available in the query.
$alias | What this relationship will be called, and is also the alias for the table. | |
views_join | $join A views_join object (or derived object) to join the alias in. | |
$base | The name of the 'base' table this relationship represents; this tells the join search which path to attempt to use when finding the path to this relationship. | |
$link_point | If this relationship links to something other than the primary table, specify that table here. For example, a 'track' node might have a relationship to an 'album' node, which might have a relationship to an 'artist' node. |
Definition at line 261 of file views_plugin_query_default.inc.
References adjust_join().
{ if (empty($link_point)) { $link_point = $this->base_table; } elseif (!array_key_exists($link_point, $this->relationships)) { return FALSE; } // Make sure $alias isn't already used; if it, start adding stuff. $alias_base = $alias; $count = 1; while (!empty($this->relationships[$alias])) { $alias = $alias_base . '_' . $count++; } // Make sure this join is adjusted for our relationship. if ($link_point && isset($this->relationships[$link_point])) { $join = $this->adjust_join($join, $link_point); } // Add the table directly to the queue to avoid accidentally marking // it. $this->table_queue[$alias] = array( 'table' => $join->table, 'num' => 1, 'alias' => $alias, 'join' => $join, 'relationship' => $link_point, ); $this->relationships[$alias] = array( 'link' => $link_point, 'table' => $join->table, 'base' => $base, ); $this->tables[$this->base_table][$alias] = array( 'count' => 1, 'alias' => $alias, ); return $alias; }
views_plugin_query_default::add_signature | ( | &$ | view | ) |
Add a signature to the query, if such a thing is feasible.
This signature is something that can be used when perusing query logs to discern where particular queries might be coming from.
view | $view The view which is executed. |
Reimplemented from views_plugin_query.
Definition at line 1424 of file views_plugin_query_default.inc.
{ $view->query->add_field(NULL, "'" . $view->name . ':' . $view->current_display . "'", 'view_name'); }
views_plugin_query_default::add_table | ( | $ | table, | |
$ | relationship = NULL , |
|||
$ | join = NULL , |
|||
$ | alias = NULL | |||
) |
Add a table to the query, ensuring the path exists.
This function will test to ensure that the path back to the primary table is valid and exists; if you do not wish for this testing to occur, use $query->queue_table() instead.
$table | The name of the table to add. It needs to exist in the global table array. | |
$relationship | An alias of a table; if this is set, the path back to this table will be tested prior to adding the table, making sure that all intermediary tables exist and are properly aliased. If set to NULL the path to the primary table will be ensured. If the path cannot be made, the table will NOT be added. | |
views_join | $join In some join configurations this table may actually join back through a different method; this is most likely to be used when tracing a hierarchy path. (node->parent->parent2->parent3). This parameter will specify how this table joins if it is not the default. | |
$alias | A specific alias to use, rather than the default alias. |
Definition at line 335 of file views_plugin_query_default.inc.
References adjust_join(), ensure_path(), and queue_table().
{ if (!$this->ensure_path($table, $relationship, $join)) { return FALSE; } if ($join && $relationship) { $join = $this->adjust_join($join, $relationship); } return $this->queue_table($table, $relationship, $join, $alias); }
views_plugin_query_default::add_tag | ( | $ | tag | ) |
Adds a query tag to the sql object.
Definition at line 1014 of file views_plugin_query_default.inc.
{ $this->tags[] = $tag; }
views_plugin_query_default::add_where | ( | $ | group, | |
$ | field, | |||
$ | value = NULL , |
|||
$ | operator = NULL | |||
) |
Add a simple WHERE clause to the query.
The caller is responsible for ensuring that all fields are fully qualified (TABLE.FIELD) and that the table already exists in the query.
$group | The WHERE group to add these to; groups are used to create AND/OR sections. Groups cannot be nested. Use 0 as the default group. If the group does not yet exist it will be created as an AND group. | |
$field | The name of the field to check. | |
$value | The value to test the field against. In most cases, this is a scalar. For more complex options, it is an array. The meaning of each element in the array is dependent on the $operator. | |
$operator | The comparison operator, such as =, <, or >=. It also accepts more complex options such as IN, LIKE, or BETWEEN. Defaults to IN if $value is an array = otherwise. If $field is a string you have to use 'formula' here. |
Definition at line 793 of file views_plugin_query_default.inc.
References views_plugin_query::set_where_group().
{ // Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all // the default group. if (empty($group)) { $group = 0; } // Check for a group. if (!isset($this->where[$group])) { $this->set_where_group('AND', $group); } $this->where[$group]['conditions'][] = array( 'field' => $field, 'value' => $value, 'operator' => $operator, ); }
views_plugin_query_default::add_where_expression | ( | $ | group, | |
$ | snippet, | |||
$ | args = array() | |||
) |
Add a complex WHERE clause to the query.
The caller is reponsible for ensuring that all fields are fully qualified (TABLE.FIELD) and that the table already exists in the query. Internally the dbtng method "where" is used.
$group | The WHERE group to add these to; groups are used to create AND/OR sections. Groups cannot be nested. Use 0 as the default group. If the group does not yet exist it will be created as an AND group. | |
$snippet | The snippet to check. This can be either a column or a complex expression like "UPPER(table.field) = 'value'" | |
$args | An associative array of arguments. |
Definition at line 831 of file views_plugin_query_default.inc.
References views_plugin_query::set_where_group().
{ // Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all // the default group. if (empty($group)) { $group = 0; } // Check for a group. if (!isset($this->where[$group])) { $this->set_where_group('AND', $group); } $this->where[$group]['conditions'][] = array( 'field' => $snippet, 'value' => $args, 'operator' => 'formula', ); }
views_plugin::additional_theme_functions | ( | ) | [inherited] |
Provide a list of additional theme functions for the theme information page.
Definition at line 518 of file plugins.inc.
References views_theme_functions().
Referenced by views_plugin_display::options_form().
{ $funcs = array(); if (!empty($this->definition['additional themes'])) { foreach ($this->definition['additional themes'] as $theme => $type) { $funcs[] = views_theme_functions($theme, $this->view, $this->display); } } return $funcs; }
views_plugin_query_default::adjust_join | ( | $ | join, | |
$ | relationship | |||
) |
Fix a join to adhere to the proper relationship; the left table can vary based upon what relationship items are joined in on.
Definition at line 610 of file views_plugin_query_default.inc.
References ensure_table().
Referenced by add_relationship(), add_table(), ensure_path(), ensure_table(), and queue_table().
{ if (!empty($join->adjusted)) { return $join; } if (empty($relationship) || empty($this->relationships[$relationship])) { return $join; } // Adjusts the left table for our relationship. if ($relationship != $this->base_table) { // If we're linking to the primary table, the relationship to use will // be the prior relationship. Unless it's a direct link. // Safety! Don't modify an original here. $join = clone $join; // Do we need to try to ensure a path? if ($join->left_table != $this->relationships[$relationship]['table'] && $join->left_table != $this->relationships[$relationship]['base'] && !isset($this->tables[$relationship][$join->left_table]['alias'])) { $this->ensure_table($join->left_table, $relationship); } // First, if this is our link point/anchor table, just use the relationship if ($join->left_table == $this->relationships[$relationship]['table']) { $join->left_table = $relationship; } // then, try the base alias. elseif (isset($this->tables[$relationship][$join->left_table]['alias'])) { $join->left_table = $this->tables[$relationship][$join->left_table]['alias']; } // But if we're already looking at an alias, use that instead. elseif (isset($this->table_queue[$relationship]['alias'])) { $join->left_table = $this->table_queue[$relationship]['alias']; } } $join->adjusted = TRUE; return $join; }
views_plugin_query_default::alter | ( | &$ | view | ) |
Let modules modify the query just prior to finalizing it.
Reimplemented from views_plugin_query.
Definition at line 1302 of file views_plugin_query_default.inc.
{ foreach (module_implements('views_query_alter') as $module) { $function = $module . '_views_query_alter'; $function($view, $this); } }
views_plugin_query_default::build | ( | &$ | view | ) |
Builds the necessary info to execute the query.
Reimplemented from views_plugin_query.
Definition at line 1312 of file views_plugin_query_default.inc.
References views_object::options(), views_plugin::query(), and set_distinct().
{ // Make the query distinct if the option was set. if (!empty($this->options['distinct'])) { $this->set_distinct(); } // Store the view in the object to be able to use it later. $this->view = $view; $view->init_pager(); // Let the pager modify the query to add limits. $this->pager->query(); $view->build_info['query'] = $this->query(); $view->build_info['count_query'] = $this->query(TRUE); }
views_plugin_query_default::build_condition | ( | $ | where = 'where' |
) |
Construct the "WHERE" or "HAVING" part of the query.
As views has to wrap the conditions from arguments with AND, a special group is wrapped around all conditions. This special group has the ID 0. There is other code in filters which makes sure that the group IDs are higher than zero.
$where | 'where' or 'having'. |
Definition at line 1043 of file views_plugin_query_default.inc.
References $where.
Referenced by query().
{ $has_condition = FALSE; $has_arguments = FALSE; $has_filter = FALSE; $main_group = db_and(); $filter_group = $this->group_operator == 'OR' ? db_or() : db_and(); foreach ($this->$where as $group => $info) { if (!empty($info['conditions'])) { $sub_group = $info['type'] == 'OR' ? db_or() : db_and(); foreach ($info['conditions'] as $key => $clause) { // DBTNG doesn't support to add the same subquery twice to the main // query and the count query, so clone the subquery to have two instances // of the same object. - http://drupal.org/node/1112854 if (is_object($clause['value']) && $clause['value'] instanceof SelectQuery) { $clause['value'] = clone $clause['value']; } if ($clause['operator'] == 'formula') { $has_condition = TRUE; $sub_group->where($clause['field'], $clause['value']); } else { $has_condition = TRUE; $sub_group->condition($clause['field'], $clause['value'], $clause['operator']); } } // Add the item to the filter group. if ($group != 0) { $has_filter = TRUE; $filter_group->condition($sub_group); } else { $has_arguments = TRUE; $main_group->condition($sub_group); } } } if ($has_filter) { $main_group->condition($filter_group); } if (!$has_arguments && $has_condition) { return $filter_group; } if ($has_arguments && $has_condition) { return $main_group; } }
views_plugin_query_default::clear_fields | ( | ) |
Remove all fields that may've been added; primarily used for summary mode where we're changing the query because we didn't get data we needed.
Definition at line 767 of file views_plugin_query_default.inc.
{ $this->fields = array(); }
views_plugin_query_default::compile_fields | ( | $ | fields_array, | |
$ | query | |||
) |
Build fields array.
Definition at line 1099 of file views_plugin_query_default.inc.
References $distinct, and get_aggregation_info().
Referenced by query().
{ $non_aggregates = array(); foreach ($fields_array as $field) { $string = ''; if (!empty($field['table'])) { $string .= $field['table'] . '.'; } $string .= $field['field']; $fieldname = (!empty($field['alias']) ? $field['alias'] : $string); if (!empty($field['distinct'])) { throw new Exception("Column-level distinct is not supported anymore."); } if (!empty($field['count'])) { // Retained for compatibility $field['function'] = 'count'; // It seems there's no way to abstract the table+column reference // without adding a field, aliasing, and then using the alias. } if (!empty($field['function'])) { $info = $this->get_aggregation_info(); if (!empty($info[$field['function']]['method']) && function_exists($info[$field['function']]['method'])) { $string = $info[$field['function']]['method']($field['function'], $string); $placeholders = !empty($field['placeholders']) ? $field['placeholders'] : array(); $query->addExpression($string, $fieldname, $placeholders); } $this->has_aggregate = TRUE; } // This is a formula, using no tables. elseif (empty($field['table'])) { $placeholders = !empty($field['placeholders']) ? $field['placeholders'] : array(); $query->addExpression($string, $fieldname, $placeholders); } elseif ($this->distinct && !in_array($fieldname, $this->groupby)) { // d7cx: This code was there, apparently needed for PostgreSQL // $string = db_driver() == 'pgsql' ? "FIRST($string)" : $string; $query->addField(!empty($field['table']) ? $field['table'] : $this->base_table, $field['field'], $fieldname); } elseif (empty($field['aggregate'])) { $non_aggregates[] = $fieldname; $query->addField(!empty($field['table']) ? $field['table'] : $this->base_table, $field['field'], $fieldname); } // @TODO Remove this old code. if (!empty($field['distinct']) && empty($field['function'])) { $distinct[] = $string; } else { $fields[] = $string; } if ($this->get_count_optimized) { // We only want the first field in this case. break; } } return array( $non_aggregates, ); }
views_object::construct | ( | ) | [inherited] |
Views handlers use a special construct function so that we can more easily construct them with variable arguments.
Reimplemented in views_handler_argument, views_handler_argument_formula, views_handler_field, views_handler_field_markup, views_handler_filter_boolean_operator, views_handler_filter_in_operator, views_handler_field_aggregator_category, views_handler_field_aggregator_title_link, views_handler_field_comment_link, views_handler_field_comment_node_link, views_handler_field_last_comment_timestamp, views_handler_field_node_new_comments, views_handler_field_filter_format_name, views_handler_argument_locale_group, views_handler_argument_locale_language, views_handler_field_locale_link_edit, views_handler_argument_node_created_fulldate, views_handler_argument_node_created_year, views_handler_argument_node_created_year_month, views_handler_argument_node_created_month, views_handler_argument_node_created_day, views_handler_argument_node_created_week, views_handler_argument_node_language, views_handler_argument_node_type, views_handler_field_node_path, views_handler_field_node_revision_link_delete, views_handler_field_node_revision_link_revert, views_handler_field_taxonomy, views_handler_field_term_link_edit, views_handler_field_node_translation_link, views_handler_field_user_link, views_handler_field_user_permissions, views_handler_field_user_picture, views_handler_field_user_roles, views_handler_filter_user_current, and views_plugin_display.
Definition at line 54 of file base.inc.
References views_object::set_default_options().
{ $this->set_default_options(); }
views_plugin_query_default::ensure_path | ( | $ | table, | |
$ | relationship = NULL , |
|||
$ | join = NULL , |
|||
$ | traced = array() , |
|||
$ | add = array() | |||
) |
Make sure that the specified table can be properly linked to the primary table in the JOINs.
This function uses recursion. If the tables needed to complete the path back to the primary table are not in the query they will be added, but additional copies will NOT be added if the table is already there.
Definition at line 558 of file views_plugin_query_default.inc.
References adjust_join(), get_join_data(), and queue_table().
Referenced by add_table(), and ensure_table().
{ if (!isset($relationship)) { $relationship = $this->base_table; } if (!array_key_exists($relationship, $this->relationships)) { return FALSE; } // If we do not have join info, fetch it. if (!isset($join)) { $join = $this->get_join_data($table, $this->relationships[$relationship]['base']); } // If it can't be fetched, this won't work. if (empty($join)) { return FALSE; } // Does a table along this path exist? if (isset($this->tables[$relationship][$table]) || ($join && $join->left_table == $relationship) || ($join && $join->left_table == $this->relationships[$relationship]['table'])) { // Make sure that we're linking to the correct table for our relationship. foreach (array_reverse($add) as $table => $path_join) { $this->queue_table($table, $relationship, $this->adjust_join($path_join, $relationship)); } return TRUE; } // Have we been this way? if (isset($traced[$join->left_table])) { // we looped. Broked. return FALSE; } // Do we have to add this table? $left_join = $this->get_join_data($join->left_table, $this->relationships[$relationship]['base']); if (!isset($this->tables[$relationship][$join->left_table])) { $add[$join->left_table] = $left_join; } // Keep looking. $traced[$join->left_table] = TRUE; return $this->ensure_path($join->left_table, $relationship, $left_join, $traced, $add); }
views_plugin_query_default::ensure_table | ( | $ | table, | |
$ | relationship = NULL , |
|||
$ | join = NULL | |||
) |
Ensure a table exists in the queue; if it already exists it won't do anything, but if it doesn't it will add the table queue.
It will ensure a path leads back to the relationship table.
$table | The unaliased name of the table to ensure. | |
$relationship | The relationship to ensure the table links to. Each relationship will get a unique instance of the table being added. If not specified, will be the primary table. | |
views_join | $join A views_join object (or derived object) to join the alias in. |
Definition at line 479 of file views_plugin_query_default.inc.
References adjust_join(), ensure_path(), get_join_data(), and queue_table().
Referenced by add_field(), add_orderby(), and adjust_join().
{ // ensure a relationship if (empty($relationship)) { $relationship = $this->base_table; } // If the relationship is the primary table, this actually be a relationship // link back from an alias. We store all aliases along with the primary table // to detect this state, because eventually it'll hit a table we already // have and that's when we want to stop. if ($relationship == $this->base_table && !empty($this->tables[$relationship][$table])) { return $this->tables[$relationship][$table]['alias']; } if (!array_key_exists($relationship, $this->relationships)) { return FALSE; } if ($table == $this->relationships[$relationship]['base']) { return $relationship; } // If we do not have join info, fetch it. if (!isset($join)) { $join = $this->get_join_data($table, $this->relationships[$relationship]['base']); } // If it can't be fetched, this won't work. if (empty($join)) { return; } // Adjust this join for the relationship, which will ensure that the 'base' // table it links to is correct. Tables adjoined to a relationship // join to a link point, not the base table. $join = $this->adjust_join($join, $relationship); if ($this->ensure_path($table, $relationship, $join)) { // Attempt to eliminate redundant joins. If this table's // relationship and join exactly matches an existing table's // relationship and join, we do not have to join to it again; // just return the existing table's alias. See // http://groups.drupal.org/node/11288 for details. // // This can be done safely here but not lower down in // queue_table(), because queue_table() is also used by // add_table() which requires the ability to intentionally add // the same table with the same join multiple times. For // example, a view that filters on 3 taxonomy terms using AND // needs to join taxonomy_term_data 3 times with the same join. // scan through the table queue to see if a matching join and // relationship exists. If so, use it instead of this join. // TODO: Scanning through $this->table_queue results in an // O(N^2) algorithm, and this code runs every time the view is // instantiated (Views 2 does not currently cache queries). // There are a couple possible "improvements" but we should do // some performance testing before picking one. foreach ($this->table_queue as $queued_table) { // In PHP 4 and 5, the == operation returns TRUE for two objects // if they are instances of the same class and have the same // attributes and values. if ($queued_table['relationship'] == $relationship && $queued_table['join'] == $join) { return $queued_table['alias']; } } return $this->queue_table($table, $relationship, $join); } }
views_plugin_query_default::execute | ( | &$ | view | ) |
Executes the query and fills the associated view object with according values.
Values to set: $view->result, $view->total_rows, $view->execute_time, $view->current_page.
Reimplemented from views_plugin_query.
Definition at line 1337 of file views_plugin_query_default.inc.
References views_object::options(), views_fetch_data(), and vpr().
{ $external = FALSE; // Whether this query will run against an external database. $query = $view->build_info['query']; $count_query = $view->build_info['count_query']; $query->addMetaData('view', $view); $count_query->addMetaData('view', $view); if (empty($this->options['disable_sql_rewrite'])) { $base_table_data = views_fetch_data($this->base_table); if (isset($base_table_data['table']['base']['access query tag'])) { $access_tag = $base_table_data['table']['base']['access query tag']; $query->addTag($access_tag); $count_query->addTag($access_tag); } } $items = array(); if ($query) { $additional_arguments = module_invoke_all('views_query_substitutions', $view); // Count queries must be run through the preExecute() method. // If not, then hook_query_node_access_alter() may munge the count by // adding a distinct against an empty query string // (e.g. COUNT DISTINCT(1) ...) and no pager will return. // See pager.inc > PagerDefault::execute() // http://api.drupal.org/api/drupal/includes--pager.inc/function/PagerDefault::execute/7 // See http://drupal.org/node/1046170. $count_query->preExecute(); // Build the count query. $count_query = $count_query->countQuery(); // Add additional arguments as a fake condition. // XXX: this doesn't work... because PDO mandates that all bound arguments // are used on the query. TODO: Find a better way to do this. if (!empty($additional_arguments)) { // $query->where('1 = 1', $additional_arguments); // $count_query->where('1 = 1', $additional_arguments); } $start = microtime(TRUE); try { if ($this->pager->use_count_query() || !empty($view->get_total_rows)) { $this->pager->execute_count_query($count_query); } // Let the pager modify the query to add limits. $this->pager->pre_execute($query); if (!empty($this->limit) || !empty($this->offset)) { // We can't have an offset without a limit, so provide a very large limit instead. $limit = intval(!empty($this->limit) ? $this->limit : 999999); $offset = intval(!empty($this->offset) ? $this->offset : 0); $query->range($offset, $limit); } $result = $query->execute(); $view->result = array(); foreach ($result as $item) { $view->result[] = $item; } $this->pager->post_execute($view->result); if ($this->pager->use_pager()) { $view->total_rows = $this->pager->get_total_items(); } } catch (Exception $e) { $view->result = array(); if (!empty($view->live_preview)) { drupal_set_message(time()); drupal_set_message($e->getMessage(), 'error'); } else { vpr('Exception in @human_name[@view_name]: @message', array('@human_name' => $view->human_name, '@view_name' => $view->name, '@message' => $e->getMessage())); } } } $view->execute_time = microtime(TRUE) - $start; }
views_plugin_query_default::get_aggregation_info | ( | ) |
Get aggregation info for group by queries.
If NULL, aggregation is not allowed.
Reimplemented from views_plugin_query.
Definition at line 1428 of file views_plugin_query_default.inc.
Referenced by compile_fields().
{ // @todo -- need a way to get database specific and customized aggregation // functions into here. return array( 'group' => array( 'title' => t('Group results together'), 'is aggregate' => FALSE, ), 'count' => array( 'title' => t('Count'), 'method' => 'views_query_default_aggregation_method_simple', 'handler' => array( 'argument' => 'views_handler_argument_group_by_numeric', 'field' => 'views_handler_field_numeric', 'filter' => 'views_handler_filter_group_by_numeric', 'sort' => 'views_handler_sort_group_by_numeric', ), ), 'count_distinct' => array( 'title' => t('Count DISTINCT'), 'method' => 'views_query_default_aggregation_method_distinct', 'handler' => array( 'argument' => 'views_handler_argument_group_by_numeric', 'field' => 'views_handler_field_numeric', 'filter' => 'views_handler_filter_group_by_numeric', 'sort' => 'views_handler_sort_group_by_numeric', ), ), 'sum' => array( 'title' => t('Sum'), 'method' => 'views_query_default_aggregation_method_simple', 'handler' => array( 'argument' => 'views_handler_argument_group_by_numeric', 'filter' => 'views_handler_filter_group_by_numeric', 'sort' => 'views_handler_sort_group_by_numeric', ), ), 'avg' => array( 'title' => t('Average'), 'method' => 'views_query_default_aggregation_method_simple', 'handler' => array( 'argument' => 'views_handler_argument_group_by_numeric', 'filter' => 'views_handler_filter_group_by_numeric', 'sort' => 'views_handler_sort_group_by_numeric', ), ), 'min' => array( 'title' => t('Minimum'), 'method' => 'views_query_default_aggregation_method_simple', 'handler' => array( 'argument' => 'views_handler_argument_group_by_numeric', 'filter' => 'views_handler_filter_group_by_numeric', 'sort' => 'views_handler_sort_group_by_numeric', ), ), 'max' => array( 'title' => t('Maximum'), 'method' => 'views_query_default_aggregation_method_simple', 'handler' => array( 'argument' => 'views_handler_argument_group_by_numeric', 'filter' => 'views_handler_filter_group_by_numeric', 'sort' => 'views_handler_sort_group_by_numeric', ), ), ); }
views_plugin_query_default::get_field_alias | ( | $ | table_alias, | |
$ | field | |||
) |
Returns the alias for the given field added to $table.
Definition at line 1005 of file views_plugin_query_default.inc.
Referenced by get_result_entities().
{
return isset($this->field_aliases[$table_alias][$field]) ? $this->field_aliases[$table_alias][$field] : FALSE;
}
views_plugin_query_default::get_join_data | ( | $ | table, | |
$ | base_table | |||
) |
Retrieve join data from the larger join data cache.
$table | The table to get the join information for. | |
$base_table | The path we're following to get this join. |
Definition at line 663 of file views_plugin_query_default.inc.
References views_get_table_join().
Referenced by ensure_path(), ensure_table(), and queue_table().
{ // Check to see if we're linking to a known alias. If so, get the real // table's data instead. if (!empty($this->table_queue[$table])) { $table = $this->table_queue[$table]['table']; } return views_get_table_join($table, $base_table); }
views_plugin_query_default::get_result_entities | ( | $ | results, | |
$ | relationship = NULL | |||
) |
Returns the according entity objects for the given query results.
Reimplemented from views_plugin_query.
Definition at line 1499 of file views_plugin_query_default.inc.
References get_field_alias(), and views_fetch_data().
{ $base_table = $this->base_table; $base_table_alias = $base_table; if (!empty($relationship)) { foreach ($this->view->relationship as $current) { if ($current->alias == $relationship) { $base_table = $current->definition['base']; $base_table_alias = $relationship; break; } } } $table_data = views_fetch_data($base_table); // Bail out if the table has not specified the according entity-type. if (!isset($table_data['table']['entity type'])) { return FALSE; } $entity_type = $table_data['table']['entity type']; $info = entity_get_info($entity_type); $id_alias = $this->get_field_alias($base_table_alias, $info['entity keys']['id']); // Assemble the ids of the entities to load. $ids = array(); foreach ($results as $key => $result) { if (isset($result->$id_alias)) { $ids[$key] = $result->$id_alias; } } $entities = entity_load($entity_type, $ids); // Re-key the array by row-index. $result = array(); foreach ($ids as $key => $id) { $result[$key] = isset($entities[$id]) ? $entities[$id] : FALSE; } return array($entity_type, $result); }
views_plugin_query_default::get_table_info | ( | $ | table | ) |
Get the information associated with a table.
If you need the alias of a table with a particular relationship, use ensure_table().
Definition at line 678 of file views_plugin_query_default.inc.
{ if (!empty($this->table_queue[$table])) { return $this->table_queue[$table]; } // In rare cases we might *only* have aliased versions of the table. if (!empty($this->tables[$this->base_table][$table])) { $alias = $this->tables[$this->base_table][$table]['alias']; if (!empty($this->table_queue[$alias])) { return $this->table_queue[$alias]; } } }
views_plugin_query_default::get_where_args | ( | ) |
Get the arguments attached to the WHERE and HAVING clauses of this query.
Definition at line 1288 of file views_plugin_query_default.inc.
views_plugin_query_default::init | ( | $ | base_table = 'node' , |
|
$ | base_field = 'nid' , |
|||
$ | options | |||
) |
Constructor; Create the basic query object and fill with default values.
-- we no longer want the base field to appear automatigically. if ($base_field) { $this->fields[$base_field] = array( 'table' => $base_table, 'field' => $base_field, 'alias' => $base_field, ); }
Reimplemented from views_plugin_query.
Definition at line 95 of file views_plugin_query_default.inc.
References views_object::$options.
{ parent::init($base_table, $base_field, $options); $this->base_table = $base_table; // Predefine these above, for clarity. $this->base_field = $base_field; $this->relationships[$base_table] = array( 'link' => NULL, 'table' => $base_table, 'alias' => $base_table, 'base' => $base_table ); // init the table queue with our primary table. $this->table_queue[$base_table] = array( 'alias' => $base_table, 'table' => $base_table, 'relationship' => $base_table, 'join' => NULL, ); // init the tables with our primary table $this->tables[$base_table][$base_table] = array( 'count' => 1, 'alias' => $base_table, ); $this->count_field = array( 'table' => $base_table, 'field' => $base_field, 'alias' => $base_field, 'count' => TRUE, ); }
views_plugin_query_default::option_definition | ( | ) |
Information about options for all kinds of purposes will be held here.
'option_name' => array( - 'default' => default value, - 'translatable' => TRUE/FALSE (wrap in t() on export if true), - 'contains' => array of items this contains, with its own defaults, etc. If contains is set, the default will be ignored and assumed to be array() ),
Each option may have any of the following functions:
Reimplemented from views_object.
Definition at line 174 of file views_plugin_query_default.inc.
References views_object::$options.
{ $options = parent::option_definition(); $options['disable_sql_rewrite'] = array( 'default' => FALSE, 'translatable' => FALSE, 'bool' => TRUE, ); $options['distinct'] = array( 'default' => FALSE, 'bool' => TRUE, ); $options['slave'] = array( 'default' => FALSE, 'bool' => TRUE, ); $options['query_comment'] = array( 'default' => '', 'bool' => FALSE, ); return $options; }
views_object::options | ( | &$ | options | ) | [inherited] |
Set default options on this object.
Called by the constructor in a complex chain to deal with backward compatibility.
Reimplemented in views_plugin_style_default.
Definition at line 60 of file base.inc.
Referenced by views_handler_filter_term_node_tid::accept_exposed_input(), views_handler_filter_numeric::accept_exposed_input(), views_handler_filter_in_operator::accept_exposed_input(), views_handler_filter_date::accept_exposed_input(), views_handler_filter::accept_exposed_input(), views_test_plugin_access_test_static::access(), views_test_plugin_access_test_dynamic::access(), views_plugin_access_role::access(), views_plugin_access_perm::access(), views_handler_field::add_additional_fields(), views_handler_field_field::add_field_table(), views_handler_field_user_roles::add_self_tokens(), views_handler_field_profile_list::add_self_tokens(), views_handler_filter_history_user_timestamp::admin_summary(), views_handler_sort::admin_summary(), views_handler_filter_string::admin_summary(), views_handler_filter_numeric::admin_summary(), views_handler_filter_in_operator::admin_summary(), views_handler_filter_boolean_operator::admin_summary(), build(), views_plugin_style_table::build_sort(), views_plugin_style_table::build_sort_post(), views_plugin_cache_time::cache_expire(), views_plugin_cache_time::cache_set_expire(), views_handler_field_field::click_sort(), views_handler_field::click_sort(), views_handler_field_field::click_sortable(), views_handler_field::construct(), views_handler_argument::default_action(), views_handler_argument::default_argument_form(), views_handler_argument::default_summary(), views_handler_argument::default_summary_form(), views_plugin_display_attachment::displays_exposed(), views_handler_field_user_roles::document_self_tokens(), views_handler_field_profile_list::document_self_tokens(), views_handler_field::element_classes(), views_handler_field::element_label_classes(), views_handler_field::element_label_type(), views_handler_field_user_picture::element_type(), views_handler_field::element_type(), views_handler_field::element_wrapper_classes(), views_handler_field::element_wrapper_type(), views_plugin_style_table::even_empty(), execute(), views_plugin_pager::execute_count_query(), views_handler_argument_date::export_plugin(), views_handler_filter_term_node_tid::expose_form(), views_handler_sort::expose_form(), views_handler_filter_in_operator::expose_form(), views_handler_filter::expose_form(), views_handler_sort::expose_options(), views_handler_filter_in_operator::expose_options(), views_handler_filter_boolean_operator::expose_options(), views_handler_filter::expose_options(), views_handler_filter::exposed_form(), views_plugin_exposed_form::exposed_form_submit(), views_handler_filter::exposed_info(), views_handler_filter::exposed_translate(), views_handler_filter_user_name::exposed_validate(), views_handler_filter_term_node_tid::exposed_validate(), views_handler_filter_search::exposed_validate(), views_handler_filter_date::exposed_validate(), views_handler_filter_term_node_tid_depth::extra_options_form(), views_handler_filter_term_node_tid::extra_options_form(), views_plugin_access_role::get_access_callback(), views_plugin_access_perm::get_access_callback(), views_plugin_argument_default_raw::get_argument(), views_plugin_argument_default_php::get_argument(), views_plugin_argument_default_fixed::get_argument(), views_plugin_argument_default_user::get_argument(), views_plugin_argument_default_taxonomy_tid::get_argument(), views_handler_field_field::get_base_table(), views_handler_argument_date::get_default_argument(), views_handler::get_field(), views_plugin_pager::get_items_per_page(), views_plugin_pager::get_offset(), views_plugin_display::get_option(), views_plugin_pager::get_pager_id(), views_plugin_style::get_row_class(), views_handler_field_field::groupby_form(), views_handler::groupby_form(), views_handler_argument::has_default_argument(), views_plugin_style::init(), views_plugin_row::init(), views_plugin_query::init(), views_plugin_pager::init(), views_plugin_exposed_form::init(), views_plugin_cache::init(), views_plugin_argument_validate::init(), views_plugin_argument_default::init(), views_plugin_access::init(), views_handler_field_user_name::init(), views_handler_field_user::init(), views_plugin_argument_validate_taxonomy_term::init(), views_plugin_argument_default_taxonomy_tid::init(), views_handler_relationship_node_term_data::init(), views_handler_filter_term_node_tid::init(), views_handler_field_term_node_tid::init(), views_handler_field_accesslog_path::init(), views_plugin_row_node_view::init(), views_plugin_row_node_rss::init(), views_handler_field_node_revision::init(), views_handler_field_node::init(), views_handler_field_history_user_timestamp::init(), views_handler_field_field::init(), views_handler_field_node_new_comments::init(), views_handler_field_comment::init(), views_handler::init(), views_handler_filter::init(), views_handler_argument::init(), views_plugin_display::is_defaulted(), views_handler::is_exposed(), views_handler_relationship::label(), views_handler_field::label(), views_handler_area::label(), views_handler_field_field::multiple_options_form(), views_handler_argument::needs_style_plugin(), views_plugin_style_table::options_form(), views_plugin_style_summary_unformatted::options_form(), views_plugin_style_summary_jump_menu::options_form(), views_plugin_style_summary::options_form(), views_plugin_style_rss::options_form(), views_plugin_style_list::options_form(), views_plugin_style_jump_menu::options_form(), views_plugin_style_grid::options_form(), views_plugin_style::options_form(), views_plugin_row_fields::options_form(), views_plugin_row::options_form(), options_form(), views_plugin_pager_some::options_form(), views_plugin_pager_none::options_form(), views_plugin_pager_full::options_form(), views_plugin_exposed_form_input_required::options_form(), views_plugin_exposed_form::options_form(), views_plugin_display::options_form(), views_plugin_cache_time::options_form(), views_plugin_argument_validate_php::options_form(), views_plugin_argument_default_raw::options_form(), views_plugin_argument_default_php::options_form(), views_plugin_argument_default_fixed::options_form(), views_plugin_access_role::options_form(), views_plugin_access_perm::options_form(), views_plugin_row_user_view::options_form(), views_plugin_argument_validate_user::options_form(), views_plugin_argument_default_user::options_form(), views_handler_field_user_picture::options_form(), views_handler_field_user_name::options_form(), views_handler_field_user_mail::options_form(), views_handler_field_user_link::options_form(), views_handler_field_user::options_form(), views_handler_relationship_translation::options_form(), views_handler_field_node_language::options_form(), views_plugin_argument_validate_taxonomy_term::options_form(), views_plugin_argument_default_taxonomy_tid::options_form(), views_handler_relationship_node_term_data::options_form(), views_handler_field_term_node_tid::options_form(), views_handler_field_term_link_edit::options_form(), views_handler_field_taxonomy::options_form(), views_handler_argument_term_node_tid_depth::options_form(), views_handler_argument_term_node_tid::options_form(), views_handler_field_file_uri::options_form(), views_handler_field_file_filemime::options_form(), views_handler_field_file::options_form(), views_handler_field_accesslog_path::options_form(), views_plugin_row_search_view::options_form(), views_handler_field_search_score::options_form(), views_plugin_row_node_view::options_form(), views_plugin_row_node_rss::options_form(), views_plugin_argument_validate_node::options_form(), views_handler_field_node_type::options_form(), views_handler_field_node_revision::options_form(), views_handler_field_node_path::options_form(), views_handler_field_node_link::options_form(), views_handler_field_node::options_form(), views_handler_field_history_user_timestamp::options_form(), views_handler_field_locale_link_edit::options_form(), views_handler_field_locale_language::options_form(), views_handler_field_field::options_form(), views_handler_argument_field_list::options_form(), views_handler_field_contact_link::options_form(), views_plugin_row_comment_view::options_form(), views_plugin_row_comment_rss::options_form(), views_handler_field_node_new_comments::options_form(), views_handler_field_comment_username::options_form(), views_handler_field_comment_node_link::options_form(), views_handler_field_comment_link_edit::options_form(), views_handler_field_comment_link::options_form(), views_handler_field_comment::options_form(), views_plugin_row_aggregator_rss::options_form(), views_handler_field_aggregator_title_link::options_form(), views_handler_field_aggregator_category::options_form(), views_handler::options_form(), views_handler_sort_date::options_form(), views_handler_relationship_groupwise_max::options_form(), views_handler_relationship::options_form(), views_handler_field_url::options_form(), views_handler_field_time_interval::options_form(), views_handler_field_serialized::options_form(), views_handler_field_prerender_list::options_form(), views_handler_field_numeric::options_form(), views_handler_field_math::options_form(), views_handler_field_machine_name::options_form(), views_handler_field_date::options_form(), views_handler_field_counter::options_form(), views_handler_field_contextual_links::options_form(), views_handler_field_boolean::options_form(), views_handler_argument_string::options_form(), views_handler_argument_numeric::options_form(), views_handler_argument_null::options_form(), views_handler_argument_many_to_one::options_form(), views_handler_argument::options_form(), views_handler_area_view::options_form(), views_handler_area_text::options_form(), views_handler_area_result::options_form(), views_handler_area::options_form(), views_handler_sort::options_submit(), views_handler_relationship_groupwise_max::options_submit(), views_handler_filter::options_submit(), views_handler_sort::options_validate(), views_handler_filter_date::options_validate(), views_handler_filter::options_validate(), views_handler::placeholder(), views_handler_argument_term_node_tid_depth_modifier::pre_query(), views_plugin_argument_validate_user::process_summary_arguments(), views_plugin_argument_validate_taxonomy_term::process_summary_arguments(), views_handler_argument::process_summary_arguments(), views_plugin_style_summary::query(), views_plugin_row::query(), query(), views_plugin_pager_some::query(), views_plugin_pager_none::query(), views_plugin_pager_full::query(), views_handler_filter_user_current::query(), views_handler_relationship_translation::query(), views_handler_filter_node_tnid_child::query(), views_handler_filter_node_tnid::query(), views_handler_relationship_node_term_data::query(), views_handler_filter_term_node_tid_depth::query(), views_handler_argument_term_node_tid_depth::query(), views_handler_sort_search_score::query(), views_handler_filter_search::query(), views_handler_field_search_score::query(), views_handler_filter_node_status::query(), views_handler_filter_history_user_timestamp::query(), views_handler_relationship_entity_reverse::query(), views_handler_field_field::query(), views_handler_sort_ncs_last_updated::query(), views_handler_sort_ncs_last_comment_name::query(), views_handler_sort_comment_thread::query(), views_handler_filter_comment_user_uid::query(), views_handler_sort_menu_hierarchy::query(), views_handler_sort_group_by_numeric::query(), views_handler_sort_date::query(), views_handler_sort::query(), views_handler_relationship_groupwise_max::query(), views_handler_relationship::query(), views_handler_filter_string::query(), views_handler_filter_numeric::query(), views_handler_filter_in_operator::query(), views_handler_filter_group_by_numeric::query(), views_handler_filter_boolean_operator_string::query(), views_handler_filter_boolean_operator::query(), views_handler_filter::query(), views_handler_field::query(), views_handler_argument_string::query(), views_handler_argument_numeric::query(), views_handler_argument_many_to_one::query(), views_handler_filter_in_operator::reduce_value_options(), views_plugin_style_summary_jump_menu::render(), views_plugin_style_summary::render(), views_plugin_style_rss::render(), views_plugin_style_jump_menu::render(), views_plugin_row::render(), views_plugin_pager_mini::render(), views_plugin_pager_full::render(), views_handler_field_user_picture::render(), views_handler_field_node_language::render(), views_plugin_row_search_view::render(), views_handler_field_profile_date::render(), views_handler_field_node_path::render(), views_handler_field_history_user_timestamp::render(), views_handler_field_ncs_last_comment_name::render(), views_handler_field_last_comment_timestamp::render(), views_handler_field_comment_node_link::render(), views_handler_field_url::render(), views_handler_field_prerender_list::render(), views_handler_field_numeric::render(), views_handler_field_math::render(), views_handler_field_date::render(), views_handler_field_custom::render(), views_handler_field_counter::render(), views_handler_field_contextual_links::render(), views_handler_field_boolean::render(), views_handler_field_file_size::render(), views_handler_area_view::render(), views_handler_area_text::render(), views_handler_area_result::render(), views_plugin_style::render_grouping_sets(), views_handler_field_prerender_list::render_items(), views_handler_field_taxonomy::render_link(), views_handler_field_file::render_link(), views_handler_field_node_revision::render_link(), views_handler_field_node_link_edit::render_link(), views_handler_field_node_link_delete::render_link(), views_handler_field_node::render_link(), views_handler_field_aggregator_category::render_link(), views_handler_field_node_type::render_name(), views_handler_area_text::render_textarea(), views_handler_argument_term_node_tid_depth::set_breadcrumb(), views_handler_argument_term_node_tid::set_breadcrumb(), views_plugin_pager_full::set_current_page(), views_object::set_default_options(), views_plugin_pager::set_items_per_page(), views_plugin_pager::set_offset(), views_plugin_display::set_option(), views_plugin_display::set_override(), views_handler::set_relationship(), views_handler_sort::show_expose_button(), views_handler_filter::show_expose_button(), views_handler::show_expose_form(), views_handler_sort::show_sort_form(), views_handler_filter::store_exposed_input(), views_handler_argument_string::summary_query(), views_handler_argument_many_to_one::summary_query(), views_plugin_pager_some::summary_title(), views_plugin_pager_none::summary_title(), views_plugin_pager_mini::summary_title(), views_plugin_pager_full::summary_title(), views_plugin_cache_time::summary_title(), views_plugin_access_role::summary_title(), views_plugin_access_perm::summary_title(), views_plugin_row_user_view::summary_title(), views_plugin_row_node_view::summary_title(), views_plugin_row_node_rss::summary_title(), views_handler_argument_numeric::title(), views_handler_argument_many_to_one::title(), views_handler_field::tokenize_value(), views_handler::ui_name(), views_object::unpack_translatables(), views_plugin_pager_full::update_page_info(), views_handler_argument::uses_breadcrumb(), views_plugin_display_attachment::uses_exposed(), views_plugin_style::uses_tokens(), views_handler_filter_in_operator::validate(), views_handler_argument_null::validate_argument_basic(), views_handler_argument::validate_fail(), views_handler_filter_term_node_tid::validate_term_strings(), views_handler_filter_user_name::value_form(), views_handler_filter_term_node_tid::value_form(), views_handler_filter_history_user_timestamp::value_form(), views_handler_filter_string::value_form(), views_handler_filter_numeric::value_form(), views_handler_filter_in_operator::value_form(), views_handler_filter_equality::value_form(), views_handler_filter_boolean_operator::value_form(), and views_handler_filter_term_node_tid::value_validate().
{ }
views_plugin_query_default::options_form | ( | &$ | form, | |
&$ | form_state | |||
) |
Add settings for the ui.
Reimplemented from views_plugin_query.
Definition at line 200 of file views_plugin_query_default.inc.
References views_object::options().
{ parent::options_form($form, $form_state); $form['disable_sql_rewrite'] = array( '#title' => t('Disable SQL rewriting'), '#description' => t('Disabling SQL rewriting will disable node_access checks as well as other modules that implement hook_query_alter().'), '#type' => 'checkbox', '#default_value' => !empty($this->options['disable_sql_rewrite']), '#suffix' => '<div class="messages warning sql-rewrite-warning js-hide">' . t('WARNING: Disabling SQL rewriting means that node access security is disabled. This may allow users to see data they should not be able to see if your view is misconfigured. Please use this option only if you understand and accept this security risk.') . '</div>', ); $form['distinct'] = array( '#type' => 'checkbox', '#title' => t('Distinct'), '#description' => t('This will make the view display only distinct items. If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it does not always work. Note that this can slow queries down, so use it with caution.'), '#default_value' => !empty($this->options['distinct']), ); $form['slave'] = array( '#type' => 'checkbox', '#title' => t('Use Slave Server'), '#description' => t('This will make the query attempt to connect to a slave server if available. If no slave server is defined or available, it will fall back to the default server.'), '#default_value' => !empty($this->options['slave']), ); $form['query_comment'] = array( '#type' => 'textfield', '#title' => t('Query Comment'), '#description' => t('If set, this comment will be embedded in the query and passed to the SQL server. This can be helpful for logging or debugging.'), '#default_value' => $this->options['query_comment'], ); }
views_plugin_query::options_submit | ( | &$ | form, | |
&$ | form_state | |||
) | [inherited] |
Handle any special handling on the validate form.
Reimplemented from views_plugin.
Definition at line 91 of file views_plugin_query.inc.
{ }
views_plugin_query::options_validate | ( | &$ | form, | |
&$ | form_state | |||
) | [inherited] |
Validate the options form.
Reimplemented from views_plugin.
Definition at line 89 of file views_plugin_query.inc.
{ }
views_plugin_query_default::placeholder | ( | $ | base = 'views' |
) |
Generates a unique placeholder used in the db query.
Definition at line 1021 of file views_plugin_query_default.inc.
{ static $placeholders = array(); if (!isset($placeholders[$base])) { $placeholders[$base] = 0; return ':' . $base; } else { return ':' . $base . ++$placeholders[$base]; } }
views_plugin::plugin_title | ( | ) | [inherited] |
Return the human readable name of the display.
This appears on the ui beside each plugin and beside the settings link.
Definition at line 548 of file plugins.inc.
{ if (isset($this->definition['short title'])) { return check_plain($this->definition['short title']); } return check_plain($this->definition['title']); }
views_plugin::query | ( | ) | [inherited] |
Add anything to the query that we might need to.
Reimplemented in views_plugin_display, views_plugin_display_extender, views_plugin_exposed_form, views_plugin_exposed_form_input_required, views_plugin_pager, views_plugin_pager_full, views_plugin_pager_none, views_plugin_pager_some, views_plugin_row, views_plugin_style, views_plugin_style_summary, and views_plugin_style_summary_jump_menu.
Definition at line 506 of file plugins.inc.
Referenced by build().
{ }
views_plugin_query_default::query | ( | $ | get_count = FALSE |
) |
Generate a query and a countquery from all of the information supplied to the object.
$get_count | Provide a countquery if this is true, otherwise provide a normal query. |
An optimized count query includes just the base field instead of all the fields. Determine of this query qualifies by checking for a groupby or distinct.
Reimplemented from views_plugin_query.
Definition at line 1171 of file views_plugin_query_default.inc.
References $distinct, $groupby, $having, views_object::$options, $orderby, $where, add_field(), add_groupby(), build_condition(), compile_fields(), and views_object::options().
{ // Check query distinct value. if (empty($this->no_distinct) && $this->distinct && !empty($this->fields)) { $base_field_alias = $this->add_field($this->base_table, $this->base_field); $this->add_groupby($base_field_alias); $distinct = TRUE; } $fields_array = $this->fields; if ($get_count && !$this->groupby) { foreach ($fields_array as $field) { if (!empty($field['distinct']) || !empty($field['function'])) { $this->get_count_optimized = FALSE; break; } } } else { $this->get_count_optimized = FALSE; } if (!isset($this->get_count_optimized)) { $this->get_count_optimized = TRUE; } $options = array(); $target = 'default'; $key = 'default'; // Detect an external database and set the if (isset($this->view->base_database)) { $key = $this->view->base_database; } // Set the slave target if the slave option is set if (!empty($this->options['slave'])) { $target = 'slave'; } // Go ahead and build the query. // db_select doesn't support to specify the key, so use getConnection directly. $query = Database::getConnection($target, $key) ->select($this->base_table, $this->base_table, $options) ->addTag('views') ->addTag('views_' . $this->view->name); // Add the tags added to the view itself. foreach ($this->tags as $tag) { $query->addTag($tag); } if (!empty($distinct)) { $query->distinct(); } $joins = $where = $having = $orderby = $groupby = ''; $fields = $distinct = array(); // Add all the tables to the query via joins. We assume all LEFT joins. foreach ($this->table_queue as $table) { if (is_object($table['join'])) { $table['join']->build_join($query, $table, $this); } } $this->has_aggregate = FALSE; $non_aggregates = array(); list($non_aggregates) = $this->compile_fields($fields_array, $query); if (count($this->having)) { $this->has_aggregate = TRUE; } if ($this->has_aggregate && (!empty($this->groupby) || !empty($non_aggregates))) { $groupby = array_unique(array_merge($this->groupby, $non_aggregates)); foreach ($groupby as $field) { $query->groupBy($field); } if (!empty($this->having) && $condition = $this->build_condition('having')) { $query->havingCondition($condition); } } if (!$this->get_count_optimized) { // we only add the orderby if we're not counting. if ($this->orderby) { foreach ($this->orderby as $order) { if ($order['field'] == 'rand_') { $query->orderRandom(); } else { $query->orderBy($order['field'], $order['direction']); } } } } if (!empty($this->where) && $condition = $this->build_condition('where')) { $query->condition($condition); } // Add a query comment. if (!empty($this->options['query_comment'])) { $query->comment($this->options['query_comment']); } // Add all query substitutions as metadata. $query->addMetaData('views_substitutions', module_invoke_all('views_query_substitutions', $this)); return $query; }
views_plugin_query_default::queue_table | ( | $ | table, | |
$ | relationship = NULL , |
|||
$ | join = NULL , |
|||
$ | alias = NULL | |||
) |
Add a table to the query without ensuring the path.
This is a pretty internal function to Views and add_table() or ensure_table() should be used instead of this one, unless you are absolutely sure this is what you want.
$table | The name of the table to add. It needs to exist in the global table array. | |
$relationship | The primary table alias this table is related to. If not set, the primary table will be used. | |
views_join | $join In some join configurations this table may actually join back through a different method; this is most likely to be used when tracing a hierarchy path. (node->parent->parent2->parent3). This parameter will specify how this table joins if it is not the default. | |
$alias | A specific alias to use, rather than the default alias. |
Definition at line 374 of file views_plugin_query_default.inc.
References adjust_join(), and get_join_data().
Referenced by add_table(), ensure_path(), and ensure_table().
{ // If the alias is set, make sure it doesn't already exist. if (isset($this->table_queue[$alias])) { return $alias; } if (empty($relationship)) { $relationship = $this->base_table; } if (!array_key_exists($relationship, $this->relationships)) { return FALSE; } if (!$alias && $join && $relationship && !empty($join->adjusted) && $table != $join->table) { if ($relationship == $this->base_table) { $alias = $table; } else { $alias = $relationship . '_' . $table; } } // Check this again to make sure we don't blow up existing aliases for already // adjusted joins. if (isset($this->table_queue[$alias])) { return $alias; } $alias = $this->mark_table($table, $relationship, $alias); // If no alias is specified, give it the default. if (!isset($alias)) { $alias = $this->tables[$relationship][$table]['alias'] . $this->tables[$relationship][$table]['count']; } // If this is a relationship based table, add a marker with // the relationship as a primary table for the alias. if ($table != $alias) { $this->mark_table($alias, $this->base_table, $alias); } // If no join is specified, pull it from the table data. if (!isset($join)) { $join = $this->get_join_data($table, $this->relationships[$relationship]['base']); if (empty($join)) { return FALSE; } $join = $this->adjust_join($join, $relationship); } $this->table_queue[$alias] = array( 'table' => $table, 'num' => $this->tables[$relationship][$table]['count'], 'alias' => $alias, 'join' => $join, 'relationship' => $relationship, ); return $alias; }
views_plugin_query::render_pager | ( | $ | exposed_input | ) | [inherited] |
Render the pager, if necessary.
Definition at line 114 of file views_plugin_query.inc.
{ if (!empty($this->pager) && $this->pager->use_pager()) { return $this->pager->render($exposed_input); } return ''; }
views_plugin_query_default::set_count_field | ( | $ | table, | |
$ | field, | |||
$ | alias = NULL | |||
) |
Set what field the query will count() on for paging.
Definition at line 154 of file views_plugin_query_default.inc.
{ if (empty($alias)) { $alias = $table . '_' . $field; } $this->count_field = array( 'table' => $table, 'field' => $field, 'alias' => $alias, 'count' => TRUE, ); }
views_object::set_default_options | ( | ) | [inherited] |
Set default options.
For backward compatibility, it sends the options array; this is a feature that will likely disappear at some point.
Definition at line 67 of file base.inc.
References views_object::option_definition(), and views_object::options().
Referenced by views_object::construct().
{ $this->_set_option_defaults($this->options, $this->option_definition()); // Retained for complex defaults plus backward compatibility. $this->options($this->options); }
views_object::set_definition | ( | $ | definition | ) | [inherited] |
views_plugin_query_default::set_distinct | ( | $ | value = TRUE |
) |
Set the base field to be distinct.
Definition at line 145 of file views_plugin_query_default.inc.
Referenced by build().
{
if (!(isset($this->no_distinct) && $value)) {
$this->distinct = $value;
}
}
views_plugin_query::set_group_operator | ( | $ | type = 'AND' |
) | [inherited] |
Control how all WHERE and HAVING groups are put together.
$type | Either 'AND' or 'OR' |
Definition at line 159 of file views_plugin_query.inc.
{ $this->group_operator = strtoupper($type); }
views_plugin_query_default::set_header | ( | $ | header | ) |
Set the table header; used for click-sorting because it's needed info to modify the ORDER BY clause.
Definition at line 170 of file views_plugin_query_default.inc.
References $header.
{ $this->header = $header; }
views_plugin_query::set_limit | ( | $ | limit | ) | [inherited] |
Set a LIMIT on the query, specifying a maximum number of results.
Definition at line 100 of file views_plugin_query.inc.
{ $this->limit = $limit; }
views_plugin_query::set_offset | ( | $ | offset | ) | [inherited] |
Set an OFFSET on the query, specifying a number of results to skip.
Definition at line 107 of file views_plugin_query.inc.
{ $this->offset = $offset; }
views_plugin_query::set_where_group | ( | $ | type = 'AND' , |
|
$ | group = NULL , |
|||
$ | where = 'where' | |||
) | [inherited] |
Create a new grouping for the WHERE or HAVING clause.
$type | Either 'AND' or 'OR'. All items within this group will be added to the WHERE clause with this logical operator. | |
$group | An ID to use for this group. If unspecified, an ID will be generated. | |
$where | 'where' or 'having'. |
Definition at line 136 of file views_plugin_query.inc.
Referenced by add_having(), add_having_expression(), add_where(), and add_where_expression().
{ // Set an alias. $groups = &$this->$where; if (!isset($group)) { $group = empty($groups) ? 1 : max(array_keys($groups)) + 1; } // Create an empty group if (empty($groups[$group])) { $groups[$group] = array('conditions' => array(), 'args' => array()); } $groups[$group]['type'] = strtoupper($type); return $group; }
views_plugin_query::summary_title | ( | ) | [inherited] |
Returns the summary of the settings in the display.
Reimplemented from views_plugin.
Definition at line 93 of file views_plugin_query.inc.
{ return t('Settings'); }
views_plugin::theme_functions | ( | ) | [inherited] |
Provide a full list of possible theme templates used by this style.
Definition at line 511 of file plugins.inc.
References views_theme_functions().
Referenced by views_plugin_display::options_form(), views_plugin_style_summary::render(), views_plugin_style_rss::render(), views_plugin_row::render(), views_plugin_display::render(), views_plugin_row_search_view::render(), and views_plugin_style::render_grouping_sets().
{ return views_theme_functions($this->definition['theme'], $this->view, $this->display); }
views_object::unpack_options | ( | &$ | storage, | |
$ | options, | |||
$ | definition = NULL , |
|||
$ | all = TRUE , |
|||
$ | check = TRUE , |
|||
$ | localization_keys = array() | |||
) | [inherited] |
Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
Definition at line 93 of file base.inc.
References views_object::$options, and views_object::option_definition().
Referenced by views_plugin_style::init(), views_plugin_row::init(), views_plugin_query::init(), views_plugin_pager::init(), views_plugin_exposed_form::init(), views_plugin_cache::init(), views_plugin_argument_validate::init(), views_plugin_argument_default::init(), views_plugin_access::init(), and views_handler::init().
{ if ($check && !is_array($options)) { return; } if (!isset($definition)) { $definition = $this->option_definition(); } if (!empty($this->view)) { // Ensure we have a localization plugin. $this->view->init_localization(); // Set up default localization keys. Handlers and such set this for us if (empty($localization_keys) && isset($this->localization_keys)) { $localization_keys = $this->localization_keys; } // but plugins don't because there isn't a common init() these days. else if (!empty($this->is_plugin)) { if ($this->plugin_type != 'display') { $localization_keys = array($this->view->current_display); $localization_keys[] = $this->plugin_type; } } } foreach ($options as $key => $value) { if (is_array($value)) { // Ignore arrays with no definition. if (!$all && empty($definition[$key])) { continue; } if (!isset($storage[$key]) || !is_array($storage[$key])) { $storage[$key] = array(); } // If we're just unpacking our known options, and we're dropping an // unknown array (as might happen for a dependent plugin fields) go // ahead and drop that in. if (!$all && isset($definition[$key]) && !isset($definition[$key]['contains'])) { $storage[$key] = $value; continue; } $this->unpack_options($storage[$key], $value, isset($definition[$key]['contains']) ? $definition[$key]['contains'] : array(), $all, FALSE, array_merge($localization_keys, array($key))); } // Don't localize strings during editing. When editing, we need to work with // the original data, not the translated version. else if (empty($this->view->editing) && !empty($definition[$key]['translatable']) && !empty($value) || !empty($definition['contains'][$key]['translatable']) && !empty($value)) { if (!empty($this->view) && $this->view->is_translatable()) { // Allow other modules to make changes to the string before it's // sent for translation. // The $keys array is built from the view name, any localization keys // sent in, and the name of the property being processed. $format = NULL; if (isset($definition[$key]['format_key']) && isset($options[$definition[$key]['format_key']])) { $format = $options[$definition[$key]['format_key']]; } $translation_data = array( 'value' => $value, 'format' => $format, 'keys' => array_merge(array($this->view->name), $localization_keys, array($key)), ); $storage[$key] = $this->view->localization_plugin->translate($translation_data); } // Otherwise, this is a code-based string, so we can use t(). else { $storage[$key] = t($value); } } else if ($all || !empty($definition[$key])) { $storage[$key] = $value; } } }
views_object::unpack_translatable | ( | &$ | translatable, | |
$ | storage, | |||
$ | option, | |||
$ | definition, | |||
$ | parents, | |||
$ | keys = array() | |||
) | [inherited] |
Unpack a single option definition.
This function run's through all suboptions recursive.
$translatable | Stores all available translatable items. | |
$storage | ||
$option | ||
$definition | ||
$parents | ||
$keys |
Definition at line 275 of file base.inc.
References views_object::$options.
Referenced by views_object::unpack_translatables().
{ // Do not export options for which we have no settings. if (!isset($storage[$option])) { return; } // Special handling for some items if (isset($definition['unpack_translatable']) && method_exists($this, $definition['unpack_translatable'])) { return $this->{$definition['unpack_translatable']}($translatable, $storage, $option, $definition, $parents, $keys); } if (isset($definition['translatable'])) { if ($definition['translatable'] === FALSE) { return; } } // Add the current option to the parents tree. $parents[] = $option; // If it has child items, unpack those separately. if (isset($definition['contains'])) { foreach ($definition['contains'] as $sub_option => $sub_definition) { $translation_keys = array_merge($keys, array($sub_option)); $this->unpack_translatable($translatable, $storage[$option], $sub_option, $sub_definition, $parents, $translation_keys); } } // @todo Figure out this double definition stuff. $options = $storage[$option]; if (is_array($options)) { foreach ($options as $key => $value) { $translation_keys = array_merge($keys, array($key)); if (is_array($value)) { $this->unpack_translatable($translatable, $options, $key, $definition, $parents, $translation_keys); } else if (!empty($definition[$key]['translatable']) && !empty($value)) { // Build source data and add to the array $format = NULL; if (isset($definition['format_key']) && isset($options[$definition['format_key']])) { $format = $options[$definition['format_key']]; } $translatable[] = array( 'value' => $value, 'keys' => $translation_keys, 'format' => $format, ); } } } else if (!empty($definition['translatable']) && !empty($options)) { $value = $options; // Build source data and add to the array $format = NULL; if (isset($definition['format_key']) && isset($storage[$definition['format_key']])) { $format = $options[$definition['format_key']]; } $translatable[] = array( 'value' => $value, 'keys' => isset($translation_keys) ? $translation_keys : $parents, 'format' => $format, ); } }
views_object::unpack_translatables | ( | &$ | translatable, | |
$ | parents = array() | |||
) | [inherited] |
Unpacks each handler to store translatable texts.
Definition at line 256 of file base.inc.
References views_object::option_definition(), views_object::options(), and views_object::unpack_translatable().
{ foreach ($this->option_definition() as $option => $definition) { $this->unpack_translatable($translatable, $this->options, $option, $definition, $parents, array()); } }
views_plugin::validate | ( | ) | [inherited] |
Validate that the plugin is correct and can be saved.
Reimplemented in views_plugin_display, views_plugin_display_page, and views_plugin_style.
Definition at line 535 of file plugins.inc.
{ return array(); }
views_plugin_query_default::$distinct = FALSE |
A flag as to whether or not to make the primary field distinct.
Definition at line 66 of file views_plugin_query_default.inc.
Referenced by compile_fields(), and query().
views_plugin_query_default::$field_aliases = array() |
An array mapping table aliases and field names to field aliases.
Definition at line 85 of file views_plugin_query_default.inc.
views_plugin_query_default::$get_count_optimized = NULL |
Should this query be optimized for counts, for example no sorts.
Definition at line 73 of file views_plugin_query_default.inc.
views_plugin_query_default::$group_operator = 'AND' |
The default operator to use when connecting the WHERE groups.
May be AND or OR.
Definition at line 45 of file views_plugin_query_default.inc.
views_plugin_query_default::$groupby = array() |
A simple array of group by clauses.
Definition at line 55 of file views_plugin_query_default.inc.
Referenced by query().
views_plugin_query_default::$having = array() |
An array of sections of the HAVING query.
Each section is in itself an array of pieces and a flag as to whether or not it should be AND or OR.
Definition at line 40 of file views_plugin_query_default.inc.
Referenced by get_where_args(), and query().
views_plugin_query_default::$header = array() |
The table header to use for tablesort.
This matters because tablesort needs to modify the query and needs the header.
Definition at line 61 of file views_plugin_query_default.inc.
Referenced by set_header().
views_object::$options = array() [inherited] |
Except for displays, options for the object will be held here.
Definition at line 15 of file base.inc.
Referenced by views_handler_filter_string::admin_summary(), views_handler_filter_numeric::admin_summary(), views_plugin_argument_validate_php::convert_options(), views_plugin_argument_default_php::convert_options(), views_plugin_argument_default_fixed::convert_options(), views_plugin_argument_validate_user::convert_options(), views_plugin_argument_default_user::convert_options(), views_plugin_argument_validate_taxonomy_term::convert_options(), views_plugin_argument_validate_node::convert_options(), views_handler_argument::default_argument_form(), views_handler_argument::default_summary_form(), views_handler_filter_term_node_tid::extra_options_form(), views_test_plugin_access_test_static::get_access_callback(), views_test_plugin_access_test_dynamic::get_access_callback(), views_handler_field_field::get_base_table(), views_plugin_display::get_field_labels(), views_plugin_display::get_plugin(), views_handler_filter_node_type::get_value_options(), views_handler_field_field::groupby_form(), views_plugin_style::init(), views_plugin_row::init(), init(), views_plugin_query::init(), views_plugin_pager_none::init(), views_plugin_pager::init(), views_plugin_exposed_form::init(), views_plugin_cache::init(), views_plugin_argument_validate::init(), views_plugin_argument_default::init(), views_plugin_access::init(), views_plugin_argument_validate_taxonomy_term::init(), views_plugin_argument_default_taxonomy_tid::init(), views_handler_relationship_node_term_data::init(), views_handler_filter_term_node_tid::init(), views_handler_field_term_node_tid::init(), views_handler_field_file::init(), views_handler_field_accesslog_path::init(), views_plugin_row_node_view::init(), views_plugin_row_node_rss::init(), views_handler_field_node_revision::init(), views_handler_field_node::init(), views_handler_field_history_user_timestamp::init(), views_handler_relationship_entity_reverse::init(), views_handler_field_field::init(), views_handler_argument_field_list::init(), views_handler_field_node_new_comments::init(), views_handler_field_comment::init(), views_handler::init(), views_handler_sort_group_by_numeric::init(), views_handler_relationship::init(), views_handler_filter_many_to_one::init(), views_handler_filter::init(), views_handler_field_entity::init(), views_handler_field_boolean::init(), views_handler_field::init(), views_handler_argument_string::init(), views_handler_argument_many_to_one::init(), views_handler_argument::init(), views_handler_relationship_groupwise_max::left_query(), views_handler_field_field::multiple_options_form(), views_handler_filter::operator_form(), views_handler_filter_string::operator_options(), views_handler_filter_numeric::operator_options(), views_handler_filter_in_operator::operator_options(), views_test_plugin_access_test_static::option_definition(), views_test_plugin_access_test_dynamic::option_definition(), views_plugin_style_table::option_definition(), views_plugin_style_summary_unformatted::option_definition(), views_plugin_style_summary_jump_menu::option_definition(), views_plugin_style_summary::option_definition(), views_plugin_style_rss::option_definition(), views_plugin_style_list::option_definition(), views_plugin_style_jump_menu::option_definition(), views_plugin_style_grid::option_definition(), views_plugin_style::option_definition(), views_plugin_row_fields::option_definition(), views_plugin_row::option_definition(), option_definition(), views_plugin_pager_some::option_definition(), views_plugin_pager_none::option_definition(), views_plugin_pager_full::option_definition(), views_plugin_exposed_form_input_required::option_definition(), views_plugin_exposed_form::option_definition(), views_plugin_display_page::option_definition(), views_plugin_display_feed::option_definition(), views_plugin_display_block::option_definition(), views_plugin_display_attachment::option_definition(), views_plugin_display::option_definition(), views_plugin_cache_time::option_definition(), views_plugin_argument_validate_php::option_definition(), views_plugin_argument_default_raw::option_definition(), views_plugin_argument_default_php::option_definition(), views_plugin_argument_default_fixed::option_definition(), views_plugin_access_role::option_definition(), views_plugin_access_perm::option_definition(), views_plugin_row_user_view::option_definition(), views_plugin_argument_validate_user::option_definition(), views_plugin_argument_default_user::option_definition(), views_handler_field_user_picture::option_definition(), views_handler_field_user_name::option_definition(), views_handler_field_user_mail::option_definition(), views_handler_field_user_link::option_definition(), views_handler_field_user::option_definition(), views_handler_relationship_translation::option_definition(), views_handler_filter_node_tnid::option_definition(), views_handler_field_node_language::option_definition(), views_plugin_argument_validate_taxonomy_term::option_definition(), views_plugin_argument_default_taxonomy_tid::option_definition(), views_handler_relationship_node_term_data::option_definition(), views_handler_filter_term_node_tid_depth::option_definition(), views_handler_filter_term_node_tid::option_definition(), views_handler_field_term_node_tid::option_definition(), views_handler_field_term_link_edit::option_definition(), views_handler_field_taxonomy::option_definition(), views_handler_argument_term_node_tid_depth::option_definition(), views_handler_argument_term_node_tid::option_definition(), views_handler_field_file_uri::option_definition(), views_handler_field_file_filemime::option_definition(), views_handler_field_file::option_definition(), views_handler_field_accesslog_path::option_definition(), views_plugin_row_search_view::option_definition(), views_handler_filter_search::option_definition(), views_handler_field_search_score::option_definition(), views_plugin_row_node_view::option_definition(), views_plugin_row_node_rss::option_definition(), views_plugin_argument_validate_node::option_definition(), views_handler_field_node_type::option_definition(), views_handler_field_node_revision::option_definition(), views_handler_field_node_path::option_definition(), views_handler_field_node_link::option_definition(), views_handler_field_node::option_definition(), views_handler_field_history_user_timestamp::option_definition(), views_handler_field_locale_link_edit::option_definition(), views_handler_field_locale_language::option_definition(), views_handler_field_field::option_definition(), views_handler_argument_field_list::option_definition(), views_plugin_row_comment_view::option_definition(), views_plugin_row_comment_rss::option_definition(), views_handler_field_node_new_comments::option_definition(), views_handler_field_ncs_last_comment_name::option_definition(), views_handler_field_comment_username::option_definition(), views_handler_field_comment_node_link::option_definition(), views_handler_field_comment_link_edit::option_definition(), views_handler_field_comment_link::option_definition(), views_handler_field_comment::option_definition(), views_plugin_row_aggregator_rss::option_definition(), views_handler_field_aggregator_title_link::option_definition(), views_handler_field_aggregator_category::option_definition(), views_handler::option_definition(), views_handler_sort_date::option_definition(), views_handler_sort::option_definition(), views_handler_relationship_groupwise_max::option_definition(), views_handler_relationship::option_definition(), views_handler_filter_string::option_definition(), views_handler_filter_numeric::option_definition(), views_handler_filter_many_to_one::option_definition(), views_handler_filter_in_operator::option_definition(), views_handler_filter_date::option_definition(), views_handler_filter_boolean_operator::option_definition(), views_handler_filter::option_definition(), views_handler_field_url::option_definition(), views_handler_field_time_interval::option_definition(), views_handler_field_serialized::option_definition(), views_handler_field_prerender_list::option_definition(), views_handler_field_numeric::option_definition(), views_handler_field_math::option_definition(), views_handler_field_machine_name::option_definition(), views_handler_field_date::option_definition(), views_handler_field_custom::option_definition(), views_handler_field_counter::option_definition(), views_handler_field_contextual_links::option_definition(), views_handler_field_boolean::option_definition(), views_handler_field_file_size::option_definition(), views_handler_argument_string::option_definition(), views_handler_argument_numeric::option_definition(), views_handler_argument_null::option_definition(), views_handler_argument_many_to_one::option_definition(), views_handler_argument::option_definition(), views_handler_area_view::option_definition(), views_handler_area_text::option_definition(), views_handler_area_result::option_definition(), views_handler_area::option_definition(), views_plugin_style_default::options(), views_plugin_style_jump_menu::options_form(), views_plugin_style::options_form(), views_plugin_row_fields::options_form(), views_plugin_display::options_form(), views_plugin_cache_time::options_form(), views_plugin_row_user_view::options_form(), views_handler_relationship_translation::options_form(), views_plugin_argument_validate_taxonomy_term::options_form(), views_plugin_argument_default_taxonomy_tid::options_form(), views_handler_relationship_node_term_data::options_form(), views_handler_field_term_node_tid::options_form(), views_handler_field_search_score::options_form(), views_plugin_row_node_view::options_form(), views_plugin_argument_validate_node::options_form(), views_plugin_row_comment_view::options_form(), views_handler_field_boolean::options_form(), views_handler_argument::options_form(), views_handler_area_view::options_form(), views_handler_area_text::options_form(), views_plugin_row_user_view::options_form_summary_options(), views_plugin_row_node_view::options_form_summary_options(), views_plugin_row_node_rss::options_form_summary_options(), views_plugin_row_comment_view::options_form_summary_options(), views_plugin_row_comment_rss::options_form_summary_options(), views_plugin_argument_validate_user::options_submit(), views_plugin_argument_validate_taxonomy_term::options_submit(), views_plugin_argument_default_taxonomy_tid::options_submit(), views_plugin_argument_validate_node::options_submit(), views_handler_argument::options_submit(), views_plugin_display_page::options_summary(), views_plugin_display_feed::options_summary(), views_plugin_display_block::options_summary(), views_plugin_display_attachment::options_summary(), views_plugin_display::options_summary(), views_plugin_pager_full::options_validate(), query(), views_handler_field_field::query(), views_handler_filter_in_operator::reduce_value_options(), views_plugin_style_summary_jump_menu::render(), views_plugin_style_jump_menu::render(), views_handler_field_locale_language::render(), views_plugin_display::set_override(), views_handler_sort::show_sort_form(), views_plugin_row_user_view::summary_title(), views_plugin_row_node_view::summary_title(), views_plugin_row_node_rss::summary_title(), views_object::unpack_options(), views_object::unpack_translatable(), views_handler_filter_term_node_tid::value_form(), and views_handler_filter_in_operator::value_form().
views_plugin_query_default::$orderby = array() |
A simple array of order by clauses.
Definition at line 50 of file views_plugin_query_default.inc.
Referenced by query().
views_plugin_query_default::$pager = NULL |
A pager plugin that should be provided by the display.
Reimplemented from views_plugin_query.
Definition at line 80 of file views_plugin_query_default.inc.
views_plugin::$plugin_type = NULL [inherited] |
The plugin type of this plugin, for example style or query.
Definition at line 475 of file plugins.inc.
Referenced by views_plugin_display::export_plugin(), and views_plugin_display::unpack_plugin().
views_plugin_query_default::$relationships = array() |
Holds an array of relationships, which are aliases of the primary table that represent different ways to join the same table in.
Definition at line 27 of file views_plugin_query_default.inc.
views_plugin_query_default::$table_queue = array() |
A list of tables in the order they should be added, keyed by alias.
Definition at line 16 of file views_plugin_query_default.inc.
views_plugin_query_default::$tables = array() |
Holds an array of tables and counts added so that we can create aliases.
Definition at line 21 of file views_plugin_query_default.inc.
views_plugin_query_default::$tags = array() |
Query tags which will be passed over to the dbtng query object.
Definition at line 90 of file views_plugin_query_default.inc.
views_plugin_query_default::$where = array() |
An array of sections of the WHERE query.
Each section is in itself an array of pieces and a flag as to whether or not it should be AND or OR.
Definition at line 34 of file views_plugin_query_default.inc.
Referenced by build_condition(), get_where_args(), and query().