function MappingTest::filterNumericFields

Same name and namespace in other branches
  1. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest::filterNumericFields()
  2. 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest::filterNumericFields()
  3. 11.x 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 56

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]);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.