You are here

protected function MappingTest::filterNumericFields in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest::filterNumericFields()
  2. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest::filterNumericFields()

Restricts the allowed fields to only numeric fields.

Parameters

array $fields: An array of field labels, keyed by the field ID.

File

core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php, line 55

Class

MappingTest
Provides a test plugin for the mapping style.

Namespace

Drupal\views_test_data\Plugin\views\style

Code

protected function filterNumericFields(&$fields) {
  foreach ($this->view->field as $id => $field) {
    if (!$field instanceof NumericField) {
      unset($fields[$id]);
    }
  }
}