summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2013-06-11 22:35:49 (GMT)
committerAlex Pott2013-06-11 22:35:49 (GMT)
commitba4d4a880e4dda61d823fc1fe9e3812c6332272e (patch)
treea4b3f94376931e3059a6811fa2436f2062e3a0df
parentb48343a2e2d0c731fa3a04d7298d3658007fa322 (diff)
Issue #2002144 by phenaproxima, connork, rdrh555, zschmid, elvis2, drupalway, heddn: Rename Views method add_field() to addField().
-rw-r--r--core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php6
-rw-r--r--core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastUpdated.php2
-rw-r--r--core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php2
-rw-r--r--core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/views/display/EntityReference.php2
-rw-r--r--core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php2
-rw-r--r--core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php2
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php8
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php2
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php2
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php4
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php6
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php14
-rw-r--r--core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php4
-rw-r--r--core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/query/QueryTest.php2
14 files changed, 29 insertions, 29 deletions
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php
index e515c1d..303cf96 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php
@@ -42,10 +42,10 @@ class NcsLastCommentName extends FieldPluginBase {
// ncs_user alias so this can work with the sort handler, below.
$this->user_table = $this->query->ensure_table('ncs_users', $this->relationship, $join);
- $this->field_alias = $this->query->add_field(NULL, "COALESCE($this->user_table.name, $this->tableAlias.$this->field)", $this->tableAlias . '_' . $this->field);
+ $this->field_alias = $this->query->addField(NULL, "COALESCE($this->user_table.name, $this->tableAlias.$this->field)", $this->tableAlias . '_' . $this->field);
- $this->user_field = $this->query->add_field($this->user_table, 'name');
- $this->uid = $this->query->add_field($this->tableAlias, 'last_comment_uid');
+ $this->user_field = $this->query->addField($this->user_table, 'name');
+ $this->uid = $this->query->addField($this->tableAlias, 'last_comment_uid');
}
protected function defineOptions() {
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastUpdated.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastUpdated.php
index 4c20cb3..6c39121 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastUpdated.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastUpdated.php
@@ -22,7 +22,7 @@ class NcsLastUpdated extends Date {
public function query() {
$this->ensureMyTable();
$this->node_table = $this->query->ensure_table('node', $this->relationship);
- $this->field_alias = $this->query->add_field(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->tableAlias . '_' . $this->field);
+ $this->field_alias = $this->query->addField(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->tableAlias . '_' . $this->field);
}
}
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php
index 78aa9bf..fee088e 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php
@@ -34,7 +34,7 @@ class NcsLastCommentName extends SortPluginBase {
// the table alias. Though if we did that we'd be guessing the relationship name
// so that doesn't matter that much.
$this->user_table = $this->query->ensure_table('ncs_users', $this->relationship, $join);
- $this->user_field = $this->query->add_field($this->user_table, 'name');
+ $this->user_field = $this->query->addField($this->user_table, 'name');
// Add the field.
$this->query->add_orderby(NULL, "LOWER(COALESCE($this->user_table.name, $this->tableAlias.$this->field))", $this->options['order'], $this->tableAlias . '_' . $this->field);
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/views/display/EntityReference.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/views/display/EntityReference.php
index ea3ec89..fc46aa6 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/views/display/EntityReference.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/views/display/EntityReference.php
@@ -122,7 +122,7 @@ class EntityReference extends DisplayPluginBase {
// Make sure the id field is included in the results.
$id_field = $this->view->storage->get('base_field');
- $this->id_field_alias = $this->view->query->add_field($this->view->storage->get('base_table'), $id_field);
+ $this->id_field_alias = $this->view->query->addField($this->view->storage->get('base_table'), $id_field);
$options = $this->getOption('entity_reference_options');
diff --git a/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php b/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php
index 11919dd..5655da1 100644
--- a/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php
+++ b/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php
@@ -68,7 +68,7 @@ class Search extends ArgumentPluginBase {
$join = drupal_container()->get('plugin.manager.views.join')->createInstance('standard', $definition);
$search_total = $this->query->addRelationship('search_total', $join, $search_index);
- $this->search_score = $this->query->add_field('', "SUM($search_index.score * $search_total.count)", 'score', array('aggregate' => TRUE));
+ $this->search_score = $this->query->addField('', "SUM($search_index.score * $search_total.count)", 'score', array('aggregate' => TRUE));
if (empty($this->query->relationships[$this->relationship])) {
$base_table = $this->view->storage->get('base_table');
diff --git a/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php b/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php
index 4ebe91b..c1fcbdd 100644
--- a/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php
+++ b/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php
@@ -149,7 +149,7 @@ class Search extends FilterPluginBase {
$search_total = $this->query->addRelationship('search_total', $join, $search_index);
- $this->search_score = $this->query->add_field('', "SUM($search_index.score * $search_total.count)", 'score', array('aggregate' => TRUE));
+ $this->search_score = $this->query->addField('', "SUM($search_index.score * $search_total.count)", 'score', array('aggregate' => TRUE));
if (empty($this->query->relationships[$this->relationship])) {
$base_table = $this->view->storage->get('base_table');
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
index 7649fc6..dd86190 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php
@@ -796,7 +796,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
*
* This must:
* - add_groupby: group on this field in order to create summaries.
- * - add_field: add a 'num_nodes' field for the count. Usually it will
+ * - addField: add a 'num_nodes' field for the count. Usually it will
* be a count on $view->base_field
* - set_count_field: Reset the count field so we get the right paging.
*
@@ -806,7 +806,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
protected function summaryQuery() {
$this->ensureMyTable();
// Add the field.
- $this->base_alias = $this->query->add_field($this->tableAlias, $this->realField);
+ $this->base_alias = $this->query->addField($this->tableAlias, $this->realField);
$this->summaryNameField();
return $this->summaryBasics();
@@ -840,7 +840,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
}
if (isset($this->name_field)) {
- $this->name_alias = $this->query->add_field($this->name_table_alias, $this->name_field);
+ $this->name_alias = $this->query->addField($this->name_table_alias, $this->name_field);
}
else {
$this->name_alias = $this->base_alias;
@@ -855,7 +855,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
// Add the number of nodes counter
$distinct = ($this->view->display_handler->getOption('distinct') && empty($this->query->no_distinct));
- $count_alias = $this->query->add_field($this->view->storage->get('base_table'), $this->view->storage->get('base_field'), 'num_records', array('count' => TRUE, 'distinct' => $distinct));
+ $count_alias = $this->query->addField($this->view->storage->get('base_table'), $this->view->storage->get('base_field'), 'num_records', array('count' => TRUE, 'distinct' => $distinct));
$this->query->add_groupby($this->name_alias);
if ($count_field) {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php
index 0b9873b..0e10708 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/Formula.php
@@ -51,7 +51,7 @@ class Formula extends ArgumentPluginBase {
$formula = $this->getFormula();
// Add the field.
- $this->base_alias = $this->name_alias = $this->query->add_field(NULL, $formula, $this->field);
+ $this->base_alias = $this->name_alias = $this->query->addField(NULL, $formula, $this->field);
$this->query->set_count_field(NULL, $formula, $this->field);
return $this->summaryBasics(FALSE);
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php
index acc9f1b..3372f66 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/ManyToOne.php
@@ -177,7 +177,7 @@ class ManyToOne extends ArgumentPluginBase {
}
// Add the field.
- $this->base_alias = $this->query->add_field($this->tableAlias, $this->realField);
+ $this->base_alias = $this->query->addField($this->tableAlias, $this->realField);
$this->summaryNameField();
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php
index fe3cdb8..0fd1082 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/String.php
@@ -156,13 +156,13 @@ class String extends ArgumentPluginBase {
if (empty($this->options['glossary'])) {
// Add the field.
- $this->base_alias = $this->query->add_field($this->tableAlias, $this->realField);
+ $this->base_alias = $this->query->addField($this->tableAlias, $this->realField);
$this->query->set_count_field($this->tableAlias, $this->realField);
}
else {
// Add the field.
$formula = $this->getFormula();
- $this->base_alias = $this->query->add_field(NULL, $formula, $this->field . '_truncated');
+ $this->base_alias = $this->query->addField(NULL, $formula, $this->field . '_truncated');
$this->query->set_count_field(NULL, $formula, $this->field, $this->field . '_truncated');
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
index ca617e3..328bbfa 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
@@ -100,7 +100,7 @@ abstract class FieldPluginBase extends HandlerBase {
$this->ensureMyTable();
// Add the field.
$params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
- $this->field_alias = $this->query->add_field($this->tableAlias, $this->realField, NULL, $params);
+ $this->field_alias = $this->query->addField($this->tableAlias, $this->realField, NULL, $params);
$this->addAdditionalFields();
}
@@ -153,10 +153,10 @@ abstract class FieldPluginBase extends HandlerBase {
}
$params += $group_params;
- $this->aliases[$identifier] = $this->query->add_field($table_alias, $info['field'], NULL, $params);
+ $this->aliases[$identifier] = $this->query->addField($table_alias, $info['field'], NULL, $params);
}
else {
- $this->aliases[$info] = $this->query->add_field($this->tableAlias, $info, NULL, $group_params);
+ $this->aliases[$info] = $this->query->addField($this->tableAlias, $info, NULL, $group_params);
}
}
}
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
index b23fe4a..e76eb60 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php
@@ -743,7 +743,7 @@ class Sql extends QueryPluginBase {
* @return $name
* The name that this field can be referred to as. Usually this is the alias.
*/
- function add_field($table, $field, $alias = '', $params = array()) {
+ public function addField($table, $field, $alias = '', $params = array()) {
// We check for this specifically because it gets a special alias.
if ($table == $this->view->storage->get('base_table') && $field == $this->view->storage->get('base_field') && empty($alias)) {
$alias = $this->view->storage->get('base_field');
@@ -946,7 +946,7 @@ class Sql extends QueryPluginBase {
* one will be generated for from the $field; however, if the
* $field is a formula, this alias will likely fail.
* @param $params
- * Any params that should be passed through to the add_field.
+ * Any params that should be passed through to the addField.
*/
function add_orderby($table, $field = NULL, $order = 'ASC', $alias = '', $params = array()) {
// Only ensure the table if it's not the special random key.
@@ -965,7 +965,7 @@ class Sql extends QueryPluginBase {
}
if ($field) {
- $as = $this->add_field($table, $field, $as, $params);
+ $as = $this->addField($table, $field, $as, $params);
}
$this->orderby[] = array(
@@ -1002,7 +1002,7 @@ class Sql extends QueryPluginBase {
*
* @access protected
*
- * @see views_plugin_query_default::add_field()
+ * @see \Drupal\views\Plugin\views\query\Sql::addField
*/
protected function getFieldAlias($table_alias, $field) {
return isset($this->field_aliases[$table_alias][$field]) ? $this->field_aliases[$table_alias][$field] : FALSE;
@@ -1200,7 +1200,7 @@ class Sql extends QueryPluginBase {
public function query($get_count = FALSE) {
// Check query distinct value.
if (empty($this->no_distinct) && $this->distinct && !empty($this->fields)) {
- $base_field_alias = $this->add_field($this->view->storage->get('base_table'), $this->view->storage->get('base_field'));
+ $base_field_alias = $this->addField($this->view->storage->get('base_table'), $this->view->storage->get('base_field'));
$this->add_groupby($base_field_alias);
$distinct = TRUE;
}
@@ -1289,7 +1289,7 @@ class Sql extends QueryPluginBase {
foreach ($entity_tables as $table_alias => $table) {
$info = entity_get_info($table['entity_type']);
$base_field = empty($table['revision']) ? $info['entity_keys']['id'] : $info['entity_keys']['revision'];
- $this->add_field($table_alias, $base_field, '', $params);
+ $this->addField($table_alias, $base_field, '', $params);
}
}
@@ -1602,7 +1602,7 @@ class Sql extends QueryPluginBase {
}
public function addSignature(ViewExecutable $view) {
- $view->query->add_field(NULL, "'" . $view->storage->id() . ':' . $view->current_display . "'", 'view_name');
+ $view->query->addField(NULL, "'" . $view->storage->id() . ':' . $view->current_display . "'", 'view_name');
}
public function getAggregationInfo() {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php
index feb99ef..81b559f 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/RowPluginBase.php
@@ -121,10 +121,10 @@ abstract class RowPluginBase extends PluginBase {
if (isset($this->base_table)) {
if (isset($this->options['relationship']) && isset($this->view->relationship[$this->options['relationship']])) {
$relationship = $this->view->relationship[$this->options['relationship']];
- $this->field_alias = $this->view->query->add_field($relationship->alias, $this->base_field);
+ $this->field_alias = $this->view->query->addField($relationship->alias, $this->base_field);
}
else {
- $this->field_alias = $this->view->query->add_field($this->base_table, $this->base_field);
+ $this->field_alias = $this->view->query->addField($this->base_table, $this->base_field);
}
}
}
diff --git a/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/query/QueryTest.php b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/query/QueryTest.php
index e37ac8c..48545c8 100644
--- a/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/query/QueryTest.php
+++ b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/query/QueryTest.php
@@ -69,7 +69,7 @@ class QueryTest extends QueryPluginBase {
}
- public function add_field($table, $field, $alias = '', $params = array()) {
+ public function addField($table, $field, $alias = '', $params = array()) {
$this->fields[$field] = $field;
return $field;
}