diff --git a/core/modules/comment/src/Plugin/views/filter/NodeComment.php b/core/modules/comment/src/Plugin/views/filter/NodeComment.php index cdb2496d95e3760ebc9ac19061c9edfcabd4317a..958d6dfde074d8c6139741e328b7dddb7944e9ce 100644 --- a/core/modules/comment/src/Plugin/views/filter/NodeComment.php +++ b/core/modules/comment/src/Plugin/views/filter/NodeComment.php @@ -20,7 +20,7 @@ class NodeComment extends InOperator { public function getValueOptions() { - $this->value_options = array( + $this->valueOptions = array( CommentItemInterface::HIDDEN => $this->t('Hidden'), CommentItemInterface::CLOSED => $this->t('Closed'), CommentItemInterface::OPEN => $this->t('Open'), diff --git a/core/modules/field/src/Plugin/views/filter/FieldList.php b/core/modules/field/src/Plugin/views/filter/FieldList.php index 42061e11a2c4a079a48cfef6d931abe6cc697f4c..f365fc4b6d0c3f4ffc0ea36cae8b904ec4c99a9a 100644 --- a/core/modules/field/src/Plugin/views/filter/FieldList.php +++ b/core/modules/field/src/Plugin/views/filter/FieldList.php @@ -21,7 +21,7 @@ class FieldList extends ManyToOne { public function getValueOptions() { $field_storage_definitions = \Drupal::entityManager()->getFieldStorageDefinitions($this->definition['entity_type']); $field_storage = $field_storage_definitions[$this->definition['field_name']]; - $this->value_options = list_allowed_values($field_storage); + $this->valueOptions = list_allowed_values($field_storage); } } diff --git a/core/modules/file/src/Plugin/views/filter/Status.php b/core/modules/file/src/Plugin/views/filter/Status.php index 963e8a062004b018b2901ea50416ec271db6f5c5..d28cf94086d351891b51542e2ebc3fcd4758f590 100644 --- a/core/modules/file/src/Plugin/views/filter/Status.php +++ b/core/modules/file/src/Plugin/views/filter/Status.php @@ -19,8 +19,8 @@ class Status extends InOperator { public function getValueOptions() { - if (!isset($this->value_options)) { - $this->value_options = _views_file_status(); + if (!isset($this->valueOptions)) { + $this->valueOptions = _views_file_status(); } } diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php index af4811e0c7877406a8ed9e3a8a5d05b89e6f6504..d1b727839283817988487fc7c04ff0093ddcf78b 100644 --- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php @@ -348,14 +348,14 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { } public function adminSummary() { - // set up $this->value_options for the parent summary - $this->value_options = array(); + // set up $this->valueOptions for the parent summary + $this->valueOptions = array(); if ($this->value) { $this->value = array_filter($this->value); $terms = Term::loadMultiple($this->value); foreach ($terms as $term) { - $this->value_options[$term->id()] = String::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); + $this->valueOptions[$term->id()] = String::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); } } return parent::adminSummary(); diff --git a/core/modules/user/src/Plugin/views/filter/Name.php b/core/modules/user/src/Plugin/views/filter/Name.php index 10a55e25ee0591a1cdeb74747664df143a4e3f6f..531dc5d3ad76d29ee86ff79f8e955790197d02a4 100644 --- a/core/modules/user/src/Plugin/views/filter/Name.php +++ b/core/modules/user/src/Plugin/views/filter/Name.php @@ -149,17 +149,17 @@ protected function valueSubmit($form, FormStateInterface $form_state) { public function getValueOptions() { } public function adminSummary() { - // set up $this->value_options for the parent summary - $this->value_options = array(); + // set up $this->valueOptions for the parent summary + $this->valueOptions = array(); if ($this->value) { $result = entity_load_multiple_by_properties('user', array('uid' => $this->value)); foreach ($result as $account) { if ($account->id()) { - $this->value_options[$account->id()] = $account->label(); + $this->valueOptions[$account->id()] = $account->label(); } else { - $this->value_options[$account->id()] = 'Anonymous'; // Intentionally NOT translated. + $this->valueOptions[$account->id()] = 'Anonymous'; // Intentionally NOT translated. } } } diff --git a/core/modules/user/src/Plugin/views/filter/Permissions.php b/core/modules/user/src/Plugin/views/filter/Permissions.php index d3e7b50a899ea7f9b4eaf6739ffa91754834b599..a3b26aa8230d0cc8f644f0f00459a9002f8b23f2 100644 --- a/core/modules/user/src/Plugin/views/filter/Permissions.php +++ b/core/modules/user/src/Plugin/views/filter/Permissions.php @@ -60,18 +60,18 @@ public static function create(ContainerInterface $container, array $configuratio } public function getValueOptions() { - if (!isset($this->value_options)) { + if (!isset($this->valueOptions)) { $module_info = system_get_info('module'); $permissions = $this->permissionHandler->getPermissions(); foreach ($permissions as $perm => $perm_item) { $provider = $perm_item['provider']; $display_name = $module_info[$provider]['name']; - $this->value_options[$display_name][$perm] = String::checkPlain(strip_tags($perm_item['title'])); + $this->valueOptions[$display_name][$perm] = String::checkPlain(strip_tags($perm_item['title'])); } } else { - return $this->value_options; + return $this->valueOptions; } } diff --git a/core/modules/user/src/Plugin/views/filter/Roles.php b/core/modules/user/src/Plugin/views/filter/Roles.php index b68b94da174f0f82815b7414ba71360857e0c2af..014425df520aa4625bac1c3b84f081e202a918ef 100644 --- a/core/modules/user/src/Plugin/views/filter/Roles.php +++ b/core/modules/user/src/Plugin/views/filter/Roles.php @@ -19,8 +19,8 @@ class Roles extends ManyToOne { public function getValueOptions() { - $this->value_options = user_role_names(TRUE); - unset($this->value_options[DRUPAL_AUTHENTICATED_RID]); + $this->valueOptions = user_role_names(TRUE); + unset($this->valueOptions[DRUPAL_AUTHENTICATED_RID]); } /** diff --git a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php index 4e30ca968202663bb373d773f1e35bbd77a5622a..f1b65d116328cf8e093ea62a42426a6eb6586842 100644 --- a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php +++ b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php @@ -90,7 +90,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o elseif (isset($this->definition['accept_null'])) { $this->accept_null = (bool) $this->definition['accept_null']; } - $this->value_options = NULL; + $this->valueOptions = NULL; } /** @@ -108,19 +108,19 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o public function getValueOptions() { if (isset($this->definition['type'])) { if ($this->definition['type'] == 'yes-no') { - $this->value_options = array(1 => $this->t('Yes'), 0 => $this->t('No')); + $this->valueOptions = array(1 => $this->t('Yes'), 0 => $this->t('No')); } if ($this->definition['type'] == 'on-off') { - $this->value_options = array(1 => $this->t('On'), 0 => $this->t('Off')); + $this->valueOptions = array(1 => $this->t('On'), 0 => $this->t('Off')); } if ($this->definition['type'] == 'enabled-disabled') { - $this->value_options = array(1 => $this->t('Enabled'), 0 => $this->t('Disabled')); + $this->valueOptions = array(1 => $this->t('Enabled'), 0 => $this->t('Disabled')); } } // Provide a fallback if the above didn't set anything. - if (!isset($this->value_options)) { - $this->value_options = array(1 => $this->t('True'), 0 => $this->t('False')); + if (!isset($this->valueOptions)) { + $this->valueOptions = array(1 => $this->t('True'), 0 => $this->t('False')); } } @@ -133,7 +133,7 @@ protected function defineOptions() { } protected function valueForm(&$form, FormStateInterface $form_state) { - if (empty($this->value_options)) { + if (empty($this->valueOptions)) { // Initialize the array of possible values for this filter. $this->getValueOptions(); } @@ -148,7 +148,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { $form['value'] = array( '#type' => $filter_form_type, '#title' => $this->value_value, - '#options' => $this->value_options, + '#options' => $this->valueOptions, '#default_value' => $this->value, ); if (!empty($this->options['exposed'])) { @@ -178,14 +178,14 @@ public function adminSummary() { if (!empty($this->options['exposed'])) { return $this->t('exposed'); } - if (empty($this->value_options)) { + if (empty($this->valueOptions)) { $this->getValueOptions(); } // Now that we have the valid options for this filter, just return the - // human-readable label based on the current value. The value_options + // human-readable label based on the current value. The valueOptions // array is keyed with either 0 or 1, so if the current value is not // empty, use the label for 1, and if it's empty, use the label for 0. - return $this->value_options[!empty($this->value)]; + return $this->valueOptions[!empty($this->value)]; } public function defaultExposeOptions() { diff --git a/core/modules/views/src/Plugin/views/filter/Bundle.php b/core/modules/views/src/Plugin/views/filter/Bundle.php index 92b4980ef465ae24c81fd5324d77b5dd48120d86..614a75c9f32949275254e64313c6279860a2f815 100644 --- a/core/modules/views/src/Plugin/views/filter/Bundle.php +++ b/core/modules/views/src/Plugin/views/filter/Bundle.php @@ -48,9 +48,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o * Overrides \Drupal\views\Plugin\views\filter\InOperator::getValueOptions(). */ public function getValueOptions() { - if (!isset($this->value_options)) { + if (!isset($this->valueOptions)) { $types = entity_get_bundles($this->entityTypeId); - $this->value_title = $this->t('@entity types', array('@entity' => $this->entityType->getLabel())); + $this->valueTitle = $this->t('@entity types', array('@entity' => $this->entityType->getLabel())); $options = array(); foreach ($types as $type => $info) { @@ -58,10 +58,10 @@ public function getValueOptions() { } asort($options); - $this->value_options = $options; + $this->valueOptions = $options; } - return $this->value_options; + return $this->valueOptions; } /** diff --git a/core/modules/views/src/Plugin/views/filter/InOperator.php b/core/modules/views/src/Plugin/views/filter/InOperator.php index cbb781eb413c9ab0a855c00c167aca85f1ea57ae..d759f71c8c7eafcc2129102915e985184bd88542 100644 --- a/core/modules/views/src/Plugin/views/filter/InOperator.php +++ b/core/modules/views/src/Plugin/views/filter/InOperator.php @@ -32,7 +32,14 @@ class InOperator extends FilterPluginBase { * @var array * Stores all operations which are available on the form. */ - var $value_options = NULL; + protected $valueOptions = NULL; + + /** + * The filter title. + * + * @var string + */ + protected $valueTitle; /** * Overrides \Drupal\views\Plugin\views\filter\FilterPluginBase::init(). @@ -40,8 +47,8 @@ class InOperator extends FilterPluginBase { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); - $this->value_title = $this->t('Options'); - $this->value_options = NULL; + $this->valueTitle = $this->t('Options'); + $this->valueOptions = NULL; } /** @@ -53,26 +60,26 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o * possible. * * @return - * Return the stored values in $this->value_options if someone expects it. + * Return the stored values in $this->valueOptions if someone expects it. */ public function getValueOptions() { - if (isset($this->value_options)) { + if (isset($this->valueOptions)) { return; } if (isset($this->definition['options callback']) && is_callable($this->definition['options callback'])) { if (isset($this->definition['options arguments']) && is_array($this->definition['options arguments'])) { - $this->value_options = call_user_func_array($this->definition['options callback'], $this->definition['options arguments']); + $this->valueOptions = call_user_func_array($this->definition['options callback'], $this->definition['options arguments']); } else { - $this->value_options = call_user_func($this->definition['options callback']); + $this->valueOptions = call_user_func($this->definition['options callback']); } } else { - $this->value_options = array(t('Yes'), $this->t('No')); + $this->valueOptions = array(t('Yes'), $this->t('No')); } - return $this->value_options; + return $this->valueOptions; } public function defaultExposeOptions() { @@ -177,7 +184,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { } $this->getValueOptions(); - $options += $this->value_options; + $options += $this->valueOptions; $default_value = (array) $this->value; $which = 'all'; @@ -221,7 +228,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => $this->valueFormType, - '#title' => $this->value_title, + '#title' => $this->valueTitle, '#options' => $options, '#default_value' => $default_value, // These are only valid for 'select' type, but do no harm to checkboxes. @@ -254,7 +261,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { */ public function reduceValueOptions($input = NULL) { if (!isset($input)) { - $input = $this->value_options; + $input = $this->valueOptions; } // Because options may be an array of strings, or an array of mixed arrays @@ -332,7 +339,7 @@ public function adminSummary() { if (in_array($this->operator, $this->operatorValues(1))) { // Remove every element which is not known. foreach ($this->value as $value) { - if (!isset($this->value_options[$value])) { + if (!isset($this->valueOptions[$value])) { unset($this->value[$value]); } } @@ -348,8 +355,8 @@ public function adminSummary() { $keys = $this->value; $value = array_shift($keys); - if (isset($this->value_options[$value])) { - $values = UtilityString::checkPlain($this->value_options[$value]); + if (isset($this->valueOptions[$value])) { + $values = UtilityString::checkPlain($this->valueOptions[$value]); } else { $values = ''; @@ -364,8 +371,8 @@ public function adminSummary() { $values = Unicode::truncate($values, 8, FALSE, TRUE); break; } - if (isset($this->value_options[$value])) { - $values .= UtilityString::checkPlain($this->value_options[$value]); + if (isset($this->valueOptions[$value])) { + $values .= UtilityString::checkPlain($this->valueOptions[$value]); } } } @@ -418,7 +425,7 @@ public function validate() { $errors[] = $this->t('The operator is invalid on filter: @filter.', array('@filter' => $this->adminLabel(TRUE))); } if (is_array($this->value)) { - if (!isset($this->value_options)) { + if (!isset($this->valueOptions)) { // Don't validate if there are none value options provided, for example for special handlers. return $errors; } @@ -428,7 +435,7 @@ public function validate() { } // Some filter_in_operator usage uses optgroups forms, so flatten it. - $flat_options = form_options_flatten($this->value_options, TRUE); + $flat_options = form_options_flatten($this->valueOptions, TRUE); // Remove every element which is not known. foreach ($this->value as $value) { diff --git a/core/modules/views/src/Plugin/views/filter/LanguageFilter.php b/core/modules/views/src/Plugin/views/filter/LanguageFilter.php index ba7ac15ca6d77f9ed7e26fb95fb27d8dbbe66d32..45d36baffe570d8c63b40a4bdcb3df21b1489cd1 100644 --- a/core/modules/views/src/Plugin/views/filter/LanguageFilter.php +++ b/core/modules/views/src/Plugin/views/filter/LanguageFilter.php @@ -23,9 +23,9 @@ class LanguageFilter extends InOperator { * {@inheritdoc} */ public function getValueOptions() { - if (!isset($this->value_options)) { - $this->value_title = $this->t('Language'); - $this->value_options = $this->listLanguages(LanguageInterface::STATE_ALL |LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED); + if (!isset($this->valueOptions)) { + $this->valueTitle = $this->t('Language'); + $this->valueOptions = $this->listLanguages(LanguageInterface::STATE_ALL |LanguageInterface::STATE_SITE_DEFAULT | PluginBase::INCLUDE_NEGOTIATED); } } } diff --git a/core/modules/views/src/Tests/Entity/FilterEntityBundleTest.php b/core/modules/views/src/Tests/Entity/FilterEntityBundleTest.php index 98cc2e512dd590f8d85e59c060a7be3b5ce2d795..cde6f751394c6f1f8b43ffa8f44ca154d3779f45 100644 --- a/core/modules/views/src/Tests/Entity/FilterEntityBundleTest.php +++ b/core/modules/views/src/Tests/Entity/FilterEntityBundleTest.php @@ -75,7 +75,7 @@ public function testFilterEntity() { // Test we have all the results, with all types selected. $this->assertEqual(count($view->result), $this->entities['count']); - // Test the value_options of the filter handler. + // Test the valueOptions of the filter handler. $expected = array(); foreach ($this->entityBundles as $key => $info) {