You are here

protected function RearrangeFieldsTest::getViewFields in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php \Drupal\Tests\views_ui\Functional\RearrangeFieldsTest::getViewFields()
  2. 9 core/modules/views_ui/tests/src/Functional/RearrangeFieldsTest.php \Drupal\Tests\views_ui\Functional\RearrangeFieldsTest::getViewFields()

Gets the fields from the View.

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