function RearrangeFieldsTest::getViewFields

Same name in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php \Drupal\Tests\views_ui\Functional\RearrangeFieldsTest::getViewFields()
  2. 8.9.x core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php \Drupal\Tests\views_ui\Functional\RearrangeFieldsTest::getViewFields()
  3. 11.x core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php \Drupal\Tests\views_ui\Functional\RearrangeFieldsTest::getViewFields()

Gets the fields from the View.

1 call to RearrangeFieldsTest::getViewFields()
RearrangeFieldsTest::testRearrangeFields in core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php
Tests field sorting.

File

core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php, line 32

Class

RearrangeFieldsTest
Tests the reordering of fields via AJAX.

Namespace

Drupal\Tests\views_ui\Functional

Code

protected function getViewFields($view_name = 'test_view', $display_id = 'default') {
    $view = Views::getView($view_name);
    $view->setDisplay($display_id);
    $fields = [];
    foreach ($view->displayHandlers
        ->get('default')
        ->getHandlers('field') as $field => $handler) {
        $fields[] = $field;
    }
    return $fields;
}

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