diff --git a/core/modules/aggregator/src/Plugin/views/field/TitleLink.php b/core/modules/aggregator/src/Plugin/views/field/TitleLink.php index 9ab50bf..d768109 100644 --- a/core/modules/aggregator/src/Plugin/views/field/TitleLink.php +++ b/core/modules/aggregator/src/Plugin/views/field/TitleLink.php @@ -29,7 +29,7 @@ class TitleLink extends FieldPluginBase { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['link'] = 'link'; + $this->additionalFields['link'] = 'link'; } /** diff --git a/core/modules/comment/src/Plugin/views/field/Comment.php b/core/modules/comment/src/Plugin/views/field/Comment.php index 25c001d..128f845 100644 --- a/core/modules/comment/src/Plugin/views/field/Comment.php +++ b/core/modules/comment/src/Plugin/views/field/Comment.php @@ -38,12 +38,12 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o parent::init($view, $display, $options); if (!empty($this->options['link_to_comment'])) { - $this->additional_fields['cid'] = 'cid'; - $this->additional_fields['entity_id'] = array( + $this->additionalFields['cid'] = 'cid'; + $this->additionalFields['entity_id'] = array( 'table' => 'comment_field_data', 'field' => 'entity_id' ); - $this->additional_fields['entity_type'] = array( + $this->additionalFields['entity_type'] = array( 'table' => 'comment_field_data', 'field' => 'entity_type' ); diff --git a/core/modules/comment/src/Plugin/views/field/LastTimestamp.php b/core/modules/comment/src/Plugin/views/field/LastTimestamp.php index 62aabf0..61b45c7 100644 --- a/core/modules/comment/src/Plugin/views/field/LastTimestamp.php +++ b/core/modules/comment/src/Plugin/views/field/LastTimestamp.php @@ -27,7 +27,7 @@ class LastTimestamp extends Date { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['comment_count'] = 'comment_count'; + $this->additionalFields['comment_count'] = 'comment_count'; } /** diff --git a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php index 748291b..ee43935 100644 --- a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php +++ b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php @@ -70,9 +70,9 @@ public static function create(ContainerInterface $container, array $configuratio public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['entity_id'] = 'nid'; - $this->additional_fields['type'] = 'type'; - $this->additional_fields['comment_count'] = array('table' => 'comment_entity_statistics', 'field' => 'comment_count'); + $this->additionalFields['entity_id'] = 'nid'; + $this->additionalFields['type'] = 'type'; + $this->additionalFields['comment_count'] = array('table' => 'comment_entity_statistics', 'field' => 'comment_count'); } protected function defineOptions() { @@ -97,7 +97,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { public function query() { $this->ensureMyTable(); $this->addAdditionalFields(); - $this->field_alias = $this->table . '_' . $this->field; + $this->fieldAlias = $this->table . '_' . $this->field; } public function preRender(&$values) { @@ -110,7 +110,7 @@ public function preRender(&$values) { $ids = array(); foreach ($values as $id => $result) { $nids[] = $result->{$this->aliases['nid']}; - $values[$id]->{$this->field_alias} = 0; + $values[$id]->{$this->fieldAlias} = 0; // Create a reference so we can find this record in the values again. if (empty($ids[$result->{$this->aliases['nid']}])) { $ids[$result->{$this->aliases['nid']}] = array(); @@ -129,7 +129,7 @@ public function preRender(&$values) { )); foreach ($result as $node) { foreach ($ids[$node->id()] as $id) { - $values[$id]->{$this->field_alias} = $node->num_comments; + $values[$id]->{$this->fieldAlias} = $node->num_comments; } } } diff --git a/core/modules/comment/src/Plugin/views/field/StatisticsLastCommentName.php b/core/modules/comment/src/Plugin/views/field/StatisticsLastCommentName.php index cdd6988..516fae6 100644 --- a/core/modules/comment/src/Plugin/views/field/StatisticsLastCommentName.php +++ b/core/modules/comment/src/Plugin/views/field/StatisticsLastCommentName.php @@ -42,7 +42,7 @@ public function query() { // nes_user alias so this can work with the sort handler, below. $this->user_table = $this->query->ensureTable('ces_users', $this->relationship, $join); - $this->field_alias = $this->query->addField(NULL, "COALESCE($this->user_table.name, $this->tableAlias.$this->field)", $this->tableAlias . '_' . $this->field); + $this->fieldAlias = $this->query->addField(NULL, "COALESCE($this->user_table.name, $this->tableAlias.$this->field)", $this->tableAlias . '_' . $this->field); $this->user_field = $this->query->addField($this->user_table, 'name'); $this->uid = $this->query->addField($this->tableAlias, 'last_comment_uid'); diff --git a/core/modules/comment/src/Plugin/views/field/StatisticsLastUpdated.php b/core/modules/comment/src/Plugin/views/field/StatisticsLastUpdated.php index 860d5bd..d48ad06 100644 --- a/core/modules/comment/src/Plugin/views/field/StatisticsLastUpdated.php +++ b/core/modules/comment/src/Plugin/views/field/StatisticsLastUpdated.php @@ -21,7 +21,7 @@ class StatisticsLastUpdated extends Date { public function query() { $this->ensureMyTable(); $this->node_table = $this->query->ensureTable('node', $this->relationship); - $this->field_alias = $this->query->addField(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->tableAlias . '_' . $this->field); + $this->fieldAlias = $this->query->addField(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->tableAlias . '_' . $this->field); } } diff --git a/core/modules/comment/src/Plugin/views/field/Username.php b/core/modules/comment/src/Plugin/views/field/Username.php index b526dbc..e1a5f9d 100644 --- a/core/modules/comment/src/Plugin/views/field/Username.php +++ b/core/modules/comment/src/Plugin/views/field/Username.php @@ -30,8 +30,8 @@ class Username extends FieldPluginBase { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['uid'] = 'uid'; - $this->additional_fields['homepage'] = 'homepage'; + $this->additionalFields['uid'] = 'uid'; + $this->additionalFields['homepage'] = 'homepage'; } protected function defineOptions() { diff --git a/core/modules/dblog/src/Plugin/views/field/DblogMessage.php b/core/modules/dblog/src/Plugin/views/field/DblogMessage.php index 6c94184..9018d56 100644 --- a/core/modules/dblog/src/Plugin/views/field/DblogMessage.php +++ b/core/modules/dblog/src/Plugin/views/field/DblogMessage.php @@ -30,7 +30,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o parent::init($view, $display, $options); if ($this->options['replace_variables']) { - $this->additional_fields['variables'] = 'variables'; + $this->additionalFields['variables'] = 'variables'; } } diff --git a/core/modules/field/src/Plugin/views/field/Field.php b/core/modules/field/src/Plugin/views/field/Field.php index 4705437..6ac561c 100644 --- a/core/modules/field/src/Plugin/views/field/Field.php +++ b/core/modules/field/src/Plugin/views/field/Field.php @@ -254,7 +254,7 @@ public function query($use_groupby = FALSE) { $this->get_base_table(); $entity_type = $this->definition['entity_tables'][$this->base_table]; - $fields = $this->additional_fields; + $fields = $this->additionalFields; // No need to add the entity type. $entity_type_key = array_search('entity_type', $fields); if ($entity_type_key !== FALSE) { diff --git a/core/modules/file/src/Plugin/views/field/File.php b/core/modules/file/src/Plugin/views/field/File.php index 135ff7f..15d4832 100644 --- a/core/modules/file/src/Plugin/views/field/File.php +++ b/core/modules/file/src/Plugin/views/field/File.php @@ -29,7 +29,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o parent::init($view, $display, $options); if (!empty($options['link_to_file'])) { - $this->additional_fields['uri'] = 'uri'; + $this->additionalFields['uri'] = 'uri'; } } diff --git a/core/modules/file/src/Plugin/views/field/FileMime.php b/core/modules/file/src/Plugin/views/field/FileMime.php index 5576e34..4627f21 100644 --- a/core/modules/file/src/Plugin/views/field/FileMime.php +++ b/core/modules/file/src/Plugin/views/field/FileMime.php @@ -38,7 +38,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { * {@inheritdoc} */ public function render(ResultRow $values) { - $data = $values->{$this->field_alias}; + $data = $values->{$this->fieldAlias}; if (!empty($this->options['filemime_image']) && $data !== NULL && $data !== '') { $file_icon = array( '#theme' => 'image__file_icon', diff --git a/core/modules/file/src/Plugin/views/field/Uri.php b/core/modules/file/src/Plugin/views/field/Uri.php index 2d2c481..2591c34 100644 --- a/core/modules/file/src/Plugin/views/field/Uri.php +++ b/core/modules/file/src/Plugin/views/field/Uri.php @@ -37,7 +37,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { * {@inheritdoc} */ public function render(ResultRow $values) { - $data = $values->{$this->field_alias}; + $data = $values->{$this->fieldAlias}; if (!empty($this->options['file_download_path']) && $data !== NULL && $data !== '') { $data = file_create_url($data); } diff --git a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php index 4a7d0c1..45372ea 100644 --- a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php +++ b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php @@ -39,10 +39,10 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o parent::init($view, $display, $options); if (\Drupal::currentUser()->isAuthenticated()) { - $this->additional_fields['created'] = array('table' => 'node_field_data', 'field' => 'created'); - $this->additional_fields['changed'] = array('table' => 'node_field_data', 'field' => 'changed'); + $this->additionalFields['created'] = array('table' => 'node_field_data', 'field' => 'created'); + $this->additionalFields['changed'] = array('table' => 'node_field_data', 'field' => 'changed'); if (\Drupal::moduleHandler()->moduleExists('comment') && !empty($this->options['comments'])) { - $this->additional_fields['last_comment'] = array('table' => 'comment_entity_statistics', 'field' => 'last_comment_timestamp'); + $this->additionalFields['last_comment'] = array('table' => 'comment_entity_statistics', 'field' => 'last_comment_timestamp'); } } } diff --git a/core/modules/node/src/Plugin/views/field/Node.php b/core/modules/node/src/Plugin/views/field/Node.php index ae74239..fe81812 100644 --- a/core/modules/node/src/Plugin/views/field/Node.php +++ b/core/modules/node/src/Plugin/views/field/Node.php @@ -32,7 +32,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o // Don't add the additional fields to groupby if (!empty($this->options['link_to_node'])) { - $this->additional_fields['nid'] = array('table' => 'node', 'field' => 'nid'); + $this->additionalFields['nid'] = array('table' => 'node', 'field' => 'nid'); } } @@ -68,7 +68,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { * Returns a string for the link text. */ protected function renderLink($data, ResultRow $values) { - if (!empty($this->options['link_to_node']) && !empty($this->additional_fields['nid'])) { + if (!empty($this->options['link_to_node']) && !empty($this->additionalFields['nid'])) { if ($data !== NULL && $data !== '') { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "node/" . $this->getValue($values, 'nid'); diff --git a/core/modules/node/src/Plugin/views/field/Path.php b/core/modules/node/src/Plugin/views/field/Path.php index 53b5010..2371355 100644 --- a/core/modules/node/src/Plugin/views/field/Path.php +++ b/core/modules/node/src/Plugin/views/field/Path.php @@ -28,7 +28,7 @@ class Path extends FieldPluginBase { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['nid'] = 'nid'; + $this->additionalFields['nid'] = 'nid'; } protected function defineOptions() { diff --git a/core/modules/node/src/Plugin/views/field/Revision.php b/core/modules/node/src/Plugin/views/field/Revision.php index 040c63f..4207dbb 100644 --- a/core/modules/node/src/Plugin/views/field/Revision.php +++ b/core/modules/node/src/Plugin/views/field/Revision.php @@ -29,8 +29,8 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o parent::init($view, $display, $options); if (!empty($this->options['link_to_node_revision'])) { - $this->additional_fields['vid'] = 'vid'; - $this->additional_fields['nid'] = 'nid'; + $this->additionalFields['vid'] = 'vid'; + $this->additionalFields['nid'] = 'nid'; } } protected function defineOptions() { diff --git a/core/modules/node/src/Plugin/views/field/RevisionLink.php b/core/modules/node/src/Plugin/views/field/RevisionLink.php index 5ea0835..119d77b 100644 --- a/core/modules/node/src/Plugin/views/field/RevisionLink.php +++ b/core/modules/node/src/Plugin/views/field/RevisionLink.php @@ -28,7 +28,7 @@ class RevisionLink extends Link { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['node_vid'] = array('table' => 'node_revision', 'field' => 'vid'); + $this->additionalFields['node_vid'] = array('table' => 'node_revision', 'field' => 'vid'); } /** diff --git a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php index 821ed48..b8ea434 100644 --- a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php +++ b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php @@ -141,7 +141,7 @@ public function render($row) { foreach ($this->view->field as $id => $field) { // If this is not unknown and the raw output option has been set, just get // the raw value. - if (($field->field_alias != 'unknown') && !empty($this->rawOutputOptions[$id])) { + if (($field->fieldAlias != 'unknown') && !empty($this->rawOutputOptions[$id])) { $value = $field->sanitizeValue($field->getValue($row), 'xss_admin'); } // Otherwise, pass this through the field advancedRender() method. diff --git a/core/modules/search/src/Plugin/views/field/Score.php b/core/modules/search/src/Plugin/views/field/Score.php index bb5c3fe..7307c1a 100644 --- a/core/modules/search/src/Plugin/views/field/Score.php +++ b/core/modules/search/src/Plugin/views/field/Score.php @@ -29,7 +29,7 @@ public function query() { // one or obviously this won't work. foreach ($this->view->filter as $handler) { if (isset($handler->search_score) && ($handler->relationship == $this->relationship)) { - $this->field_alias = $handler->search_score; + $this->fieldAlias = $handler->search_score; $this->tableAlias = $handler->tableAlias; return; } diff --git a/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php b/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php index a0b1e67..9e92f07 100644 --- a/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php +++ b/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php @@ -28,8 +28,8 @@ class LinkEdit extends FieldPluginBase { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['tid'] = 'tid'; - $this->additional_fields['vid'] = 'vid'; + $this->additionalFields['tid'] = 'tid'; + $this->additionalFields['vid'] = 'vid'; } protected function defineOptions() { diff --git a/core/modules/taxonomy/src/Plugin/views/field/Taxonomy.php b/core/modules/taxonomy/src/Plugin/views/field/Taxonomy.php index 2a7dd73..f9ed185 100644 --- a/core/modules/taxonomy/src/Plugin/views/field/Taxonomy.php +++ b/core/modules/taxonomy/src/Plugin/views/field/Taxonomy.php @@ -35,8 +35,8 @@ class Taxonomy extends FieldPluginBase { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['vid'] = 'vid'; - $this->additional_fields['tid'] = 'tid'; + $this->additionalFields['vid'] = 'vid'; + $this->additionalFields['tid'] = 'tid'; } protected function defineOptions() { diff --git a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php index 2bae2fe..1065a37 100644 --- a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php @@ -30,10 +30,10 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o // @todo: Wouldn't it be possible to use $this->base_table and no if here? if ($view->storage->get('base_table') == 'node_field_revision') { - $this->additional_fields['nid'] = array('table' => 'node_field_revision', 'field' => 'nid'); + $this->additionalFields['nid'] = array('table' => 'node_field_revision', 'field' => 'nid'); } else { - $this->additional_fields['nid'] = array('table' => 'node', 'field' => 'nid'); + $this->additionalFields['nid'] = array('table' => 'node', 'field' => 'nid'); } } @@ -94,7 +94,7 @@ public function query() { public function preRender(&$values) { $vocabularies = entity_load_multiple('taxonomy_vocabulary'); - $this->field_alias = $this->aliases['nid']; + $this->fieldAlias = $this->aliases['nid']; $nids = array(); foreach ($values as $result) { if (!empty($result->{$this->aliases['nid']})) { diff --git a/core/modules/user/src/Plugin/views/field/Link.php b/core/modules/user/src/Plugin/views/field/Link.php index 40ff364..31c93a0 100644 --- a/core/modules/user/src/Plugin/views/field/Link.php +++ b/core/modules/user/src/Plugin/views/field/Link.php @@ -37,7 +37,7 @@ public function usesGroupBy() { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['uid'] = 'uid'; + $this->additionalFields['uid'] = 'uid'; } protected function defineOptions() { diff --git a/core/modules/user/src/Plugin/views/field/Name.php b/core/modules/user/src/Plugin/views/field/Name.php index 5396bc6..1f749e1 100644 --- a/core/modules/user/src/Plugin/views/field/Name.php +++ b/core/modules/user/src/Plugin/views/field/Name.php @@ -32,7 +32,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o parent::init($view, $display, $options); if (!empty($this->options['overwrite_anonymous']) || !empty($this->options['format_username'])) { - $this->additional_fields['uid'] = 'uid'; + $this->additionalFields['uid'] = 'uid'; } } diff --git a/core/modules/user/src/Plugin/views/field/Permissions.php b/core/modules/user/src/Plugin/views/field/Permissions.php index 92d7171..bc1d9fd 100644 --- a/core/modules/user/src/Plugin/views/field/Permissions.php +++ b/core/modules/user/src/Plugin/views/field/Permissions.php @@ -71,12 +71,12 @@ public static function create(ContainerInterface $container, array $configuratio public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['uid'] = array('table' => 'users', 'field' => 'uid'); + $this->additionalFields['uid'] = array('table' => 'users', 'field' => 'uid'); } public function query() { $this->addAdditionalFields(); - $this->field_alias = $this->aliases['uid']; + $this->fieldAlias = $this->aliases['uid']; } public function preRender(&$values) { diff --git a/core/modules/user/src/Plugin/views/field/Roles.php b/core/modules/user/src/Plugin/views/field/Roles.php index 57506a8..5e209c0 100644 --- a/core/modules/user/src/Plugin/views/field/Roles.php +++ b/core/modules/user/src/Plugin/views/field/Roles.php @@ -61,12 +61,12 @@ public static function create(ContainerInterface $container, array $configuratio public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields['uid'] = array('table' => 'users', 'field' => 'uid'); + $this->additionalFields['uid'] = array('table' => 'users', 'field' => 'uid'); } public function query() { $this->addAdditionalFields(); - $this->field_alias = $this->aliases['uid']; + $this->fieldAlias = $this->aliases['uid']; } public function preRender(&$values) { diff --git a/core/modules/user/src/Plugin/views/field/User.php b/core/modules/user/src/Plugin/views/field/User.php index d49c7e1..6dd8aa6 100644 --- a/core/modules/user/src/Plugin/views/field/User.php +++ b/core/modules/user/src/Plugin/views/field/User.php @@ -29,7 +29,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o parent::init($view, $display, $options); if (!empty($this->options['link_to_user'])) { - $this->additional_fields['uid'] = 'uid'; + $this->additionalFields['uid'] = 'uid'; } } diff --git a/core/modules/views/src/Plugin/views/field/EntityLabel.php b/core/modules/views/src/Plugin/views/field/EntityLabel.php index 376c497..b4eac11 100644 --- a/core/modules/views/src/Plugin/views/field/EntityLabel.php +++ b/core/modules/views/src/Plugin/views/field/EntityLabel.php @@ -71,7 +71,7 @@ public static function create(ContainerInterface $container, array $configuratio */ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields[$this->definition['entity type field']] = $this->definition['entity type field']; + $this->additionalFields[$this->definition['entity type field']] = $this->definition['entity type field']; } /** diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index d4e04f9..6aad5ae 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -69,22 +69,33 @@ */ const RENDER_TEXT_PHASE_EMPTY = 2; - var $field_alias = 'unknown'; - var $aliases = array(); + /** + * The alias that results from adding a field to a query. + * + * @var string + */ + public $fieldAlias = 'unknown'; + + /** + * The generated aliases. + * + * @var array + */ + public $aliases = array(); /** * The field value prior to any rewriting. * * @var mixed */ - public $original_value = NULL; + public $originalValue = NULL; /** * @var array - * Stores additional fields which get's added to the query. + * Stores additional fields which get added to the query. * The generated aliases are stored in $aliases. */ - var $additional_fields = array(); + public $additionalFields = array(); /** * Overrides Drupal\views\Plugin\views\HandlerBase::init(). @@ -92,9 +103,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->additional_fields = array(); + $this->additionalFields = array(); if (!empty($this->definition['additional fields'])) { - $this->additional_fields = $this->definition['additional fields']; + $this->additionalFields = $this->definition['additional fields']; } if (!isset($this->options['exclude'])) { @@ -119,7 +130,7 @@ public function query() { $this->ensureMyTable(); // Add the field. $params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array(); - $this->field_alias = $this->query->addField($this->tableAlias, $this->realField, NULL, $params); + $this->fieldAlias = $this->query->addField($this->tableAlias, $this->realField, NULL, $params); $this->addAdditionalFields(); } @@ -137,10 +148,10 @@ public function query() { protected function addAdditionalFields($fields = NULL) { if (!isset($fields)) { // notice check - if (empty($this->additional_fields)) { + if (empty($this->additionalFields)) { return; } - $fields = $this->additional_fields; + $fields = $this->additionalFields; } $group_params = array(); @@ -185,11 +196,11 @@ protected function addAdditionalFields($fields = NULL) { * Called to determine what to tell the clicksorter. */ public function clickSort($order) { - if (isset($this->field_alias)) { + if (isset($this->fieldAlias)) { // Since fields should always have themselves already added, just // add a sort on the field. $params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array(); - $this->query->addOrderBy(NULL, NULL, $order, $this->field_alias, $params); + $this->query->addOrderBy(NULL, NULL, $order, $this->fieldAlias, $params); } } @@ -408,7 +419,7 @@ public function getEntity(ResultRow $values) { * Optional name of the field where the value is stored. */ public function getValue(ResultRow $values, $field = NULL) { - $alias = isset($field) ? $this->aliases[$field] : $this->field_alias; + $alias = isset($field) ? $this->aliases[$field] : $this->fieldAlias; if (isset($values->{$alias})) { return $values->{$alias}; } @@ -1133,7 +1144,7 @@ public function advancedRender(ResultRow $values) { $raw_items = $this->getItems($values); // If there are no items, set the original value to NULL. if (empty($raw_items)) { - $this->original_value = NULL; + $this->originalValue = NULL; } } else { @@ -1142,7 +1153,7 @@ public function advancedRender(ResultRow $values) { $value = drupal_render($value); } $this->last_render = $value; - $this->original_value = $value; + $this->originalValue = $value; } if ($this->allowAdvancedRender()) { @@ -1155,7 +1166,7 @@ public function advancedRender(ResultRow $values) { $value = drupal_render($value); } $this->last_render = $value; - $this->original_value = $this->last_render; + $this->originalValue = $this->last_render; $alter = $item + $this->options['alter']; $alter['phase'] = static::RENDER_TEXT_PHASE_SINGLE_ITEM; @@ -1239,7 +1250,7 @@ public function renderText($alter) { } // Check if there should be no further rewrite for empty values. - $no_rewrite_for_empty = $this->options['hide_alter_empty'] && $this->isValueEmpty($this->original_value, $this->options['empty_zero']); + $no_rewrite_for_empty = $this->options['hide_alter_empty'] && $this->isValueEmpty($this->originalValue, $this->options['empty_zero']); // Check whether the value is empty and return nothing, so the field isn't rendered. // First check whether the field should be hidden if the value(hide_alter_empty = TRUE) /the rewrite is empty (hide_alter_empty = FALSE). diff --git a/core/modules/views/src/Plugin/views/field/MachineName.php b/core/modules/views/src/Plugin/views/field/MachineName.php index 4b3521b..a7a2d96 100644 --- a/core/modules/views/src/Plugin/views/field/MachineName.php +++ b/core/modules/views/src/Plugin/views/field/MachineName.php @@ -72,7 +72,7 @@ public function preRender(&$values) { * {@inheritdoc} */ public function render(ResultRow $values) { - $value = $values->{$this->field_alias}; + $value = $values->{$this->fieldAlias}; if (!empty($this->options['machine_name']) || !isset($this->valueOptions[$value])) { $result = String::checkPlain($value); } diff --git a/core/modules/views/src/Plugin/views/field/Markup.php b/core/modules/views/src/Plugin/views/field/Markup.php index 465f655..877b2ea 100644 --- a/core/modules/views/src/Plugin/views/field/Markup.php +++ b/core/modules/views/src/Plugin/views/field/Markup.php @@ -34,9 +34,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o $this->format = $this->definition['format']; - $this->additional_fields = array(); + $this->additionalFields = array(); if (is_array($this->format)) { - $this->additional_fields['format'] = $this->format; + $this->additionalFields['format'] = $this->format; } } diff --git a/core/modules/views/src/Plugin/views/field/Serialized.php b/core/modules/views/src/Plugin/views/field/Serialized.php index c9d0dd2..8065705 100644 --- a/core/modules/views/src/Plugin/views/field/Serialized.php +++ b/core/modules/views/src/Plugin/views/field/Serialized.php @@ -65,7 +65,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { * {@inheritdoc} */ public function render(ResultRow $values) { - $value = $values->{$this->field_alias}; + $value = $values->{$this->fieldAlias}; if ($this->options['format'] == 'unserialized') { return String::checkPlain(print_r(unserialize($value), TRUE)); diff --git a/core/modules/views/src/Plugin/views/field/TimeInterval.php b/core/modules/views/src/Plugin/views/field/TimeInterval.php index 62f0286..53bb00d 100644 --- a/core/modules/views/src/Plugin/views/field/TimeInterval.php +++ b/core/modules/views/src/Plugin/views/field/TimeInterval.php @@ -80,7 +80,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { * {@inheritdoc} */ public function render(ResultRow $values) { - $value = $values->{$this->field_alias}; + $value = $values->{$this->fieldAlias}; return $this->dateFormatter->formatInterval($value, isset($this->options['granularity']) ? $this->options['granularity'] : 2); } diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php index 12e6f22..0871748 100644 --- a/core/modules/views/src/Plugin/views/filter/Combine.php +++ b/core/modules/views/src/Plugin/views/filter/Combine.php @@ -64,7 +64,7 @@ public function query() { $field = $this->view->field[$id]; // Always add the table of the selected fields to be sure a table alias exists. $field->ensureMyTable(); - if (!empty($field->field_alias) && !empty($field->field_alias)) { + if (!empty($field->fieldAlias) && !empty($field->fieldAlias)) { $fields[] = "$field->tableAlias.$field->realField"; } } diff --git a/core/modules/views/src/Plugin/views/row/OpmlFields.php b/core/modules/views/src/Plugin/views/row/OpmlFields.php index 2e936f5..4eab681 100644 --- a/core/modules/views/src/Plugin/views/row/OpmlFields.php +++ b/core/modules/views/src/Plugin/views/row/OpmlFields.php @@ -200,7 +200,7 @@ public function render($row) { '#view' => $this->view, '#options' => $this->options, '#row' => $item, - '#field_alias' => isset($this->field_alias) ? $this->field_alias : '', + '#fieldAlias' => isset($this->field_alias) ? $this->field_alias : '', ); return $build; } diff --git a/core/modules/views/src/Plugin/views/row/RowPluginBase.php b/core/modules/views/src/Plugin/views/row/RowPluginBase.php index 905f04e..7942760 100644 --- a/core/modules/views/src/Plugin/views/row/RowPluginBase.php +++ b/core/modules/views/src/Plugin/views/row/RowPluginBase.php @@ -175,7 +175,7 @@ public function render($row) { '#view' => $this->view, '#options' => $this->options, '#row' => $row, - '#field_alias' => isset($this->field_alias) ? $this->field_alias : '', + '#fieldAlias' => isset($this->field_alias) ? $this->field_alias : '', ); } diff --git a/core/modules/views/src/Plugin/views/row/RssFields.php b/core/modules/views/src/Plugin/views/row/RssFields.php index 48dcefe..a840432 100644 --- a/core/modules/views/src/Plugin/views/row/RssFields.php +++ b/core/modules/views/src/Plugin/views/row/RssFields.php @@ -178,7 +178,7 @@ public function render($row) { '#view' => $this->view, '#options' => $this->options, '#row' => $item, - '#field_alias' => isset($this->field_alias) ? $this->field_alias : '', + '#fieldAlias' => isset($this->field_alias) ? $this->field_alias : '', ); return drupal_render($build); } diff --git a/core/modules/views/src/Tests/Handler/FieldUnitTest.php b/core/modules/views/src/Tests/Handler/FieldUnitTest.php index 12fe74e..f49fcbf 100644 --- a/core/modules/views/src/Tests/Handler/FieldUnitTest.php +++ b/core/modules/views/src/Tests/Handler/FieldUnitTest.php @@ -64,9 +64,9 @@ public function testQuery() { $view->initHandlers(); $id_field = $view->field['id']; - $id_field->additional_fields['job'] = 'job'; + $id_field->additionalFields['job'] = 'job'; // Choose also a field alias key which doesn't match to the table field. - $id_field->additional_fields['created_test'] = array('table' => 'views_test_data', 'field' => 'created'); + $id_field->additionalFields['created_test'] = array('table' => 'views_test_data', 'field' => 'created'); $view->build(); // Make sure the field aliases have the expected value. diff --git a/core/modules/views/templates/views-view-field.html.twig b/core/modules/views/templates/views-view-field.html.twig index a058548..91bd468 100644 --- a/core/modules/views/templates/views-view-field.html.twig +++ b/core/modules/views/templates/views-view-field.html.twig @@ -14,7 +14,7 @@ * - output: The processed output that will normally be used. * * When fetching output from the row this construct should be used: - * data = row[field.field_alias] + * data = row[field.fieldAlias] * * The above will guarantee that you'll always get the correct data, regardless * of any changes in the aliasing that might happen if the view is modified. diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 3294836..19d3bb1 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -131,7 +131,7 @@ function views_theme($existing, $type, $theme, $path) { // attaches contextual links when the primary theme argument is an array. 'display' => array('view_array' => array(), 'view' => NULL), 'style' => array('view' => NULL, 'options' => NULL, 'rows' => NULL, 'title' => NULL), - 'row' => array('view' => NULL, 'options' => NULL, 'row' => NULL, 'field_alias' => NULL), + 'row' => array('view' => NULL, 'options' => NULL, 'row' => NULL, 'fieldAlias' => NULL), 'exposed_form' => array('view' => NULL, 'options' => NULL), 'pager' => array( 'view' => NULL, 'options' => NULL, diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 7af7216..4a2f3af 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -195,8 +195,8 @@ function template_preprocess_views_view_fields(&$variables) { } $object->content = $field_output; - if (isset($view->field[$id]->field_alias) && isset($variables['row']->{$view->field[$id]->field_alias})) { - $object->raw = $variables['row']->{$view->field[$id]->field_alias}; + if (isset($view->field[$id]->fieldAlias) && isset($variables['row']->{$view->field[$id]->fieldAlias})) { + $object->raw = $variables['row']->{$view->field[$id]->fieldAlias}; } else { $object->raw = NULL; // make sure it exists to reduce NOTICE @@ -329,8 +329,8 @@ function template_preprocess_views_view_grouping(&$variables) { * Display a single views field. * * Interesting bits of info: - * $field->field_alias says what the raw value in $row will be. Reach it like - * this: @code { $row->{$field->field_alias} @endcode + * $field->fieldAlias says what the raw value in $row will be. Reach it like + * this: @code { $row->{$field->fieldAlias} @endcode */ function theme_views_view_field($variables) { return $variables['output'];