You are here

protected function RearrangeFieldsTest::getViewFields in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php \Drupal\Tests\views_ui\Functional\RearrangeFieldsTest::getViewFields()
  2. 10 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 30

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