protected function WebformViewsTestBase::renderView in Webform Views Integration 8.5
Execute and render the view.
Parameters
\Drupal\views\Entity\View $view: The view to execute and render.
array $args: Optional array of argument to supply to the view during its execution.
array $exclude_fields: Array of field handler IDs that should be excluded from returned array.
Return value
array Array of rendered cells of this view. Each sub array will represent a single row of the results of the view. Such sub array will be keyed by field handlers and corresponding values will be rendered HTML markup that the view produced for that field.
8 calls to WebformViewsTestBase::renderView()
- WebformViewsArgumentTestBase::testArgument in tests/
src/ Kernel/ argument/ WebformViewsArgumentTestBase.php - Test argument handler.
- WebformViewsFieldTestBase::testClickSort in tests/
src/ Kernel/ field/ WebformViewsFieldTestBase.php - Test click sorting functionality.
- WebformViewsFieldTestBase::testField in tests/
src/ Kernel/ field/ WebformViewsFieldTestBase.php - Test field rendering.
- WebformViewsFieldTestBase::testMultiValueAllInOne in tests/
src/ Kernel/ field/ WebformViewsFieldTestBase.php - Test the multivalue element placing all values into single cell.
- WebformViewsFieldTestBase::testMultiValueDeltaOffset in tests/
src/ Kernel/ field/ WebformViewsFieldTestBase.php - Test the multivalue element placing single value into a cell.
File
- tests/
src/ Kernel/ WebformViewsTestBase.php, line 193
Class
- WebformViewsTestBase
- Reasonable starting point for testing integration between webform and views.
Namespace
Drupal\Tests\webform_views\KernelCode
protected function renderView(View $view, array $args = array(), $exclude_fields = [
'sid',
]) {
/** @var \Drupal\views\ViewExecutable $executable */
$executable = $view
->getExecutable();
$executable
->executeDisplay(NULL, $args);
$rendered_cells = [];
for ($i = 0; $i < $executable->total_rows; $i++) {
foreach ($executable
->getHandlers('field') as $handler) {
if (!in_array($handler['id'], $exclude_fields)) {
$rendered_cells[$i][$handler['id']] = (string) $executable->style_plugin
->getField($i, $handler['id']);
}
}
}
return $rendered_cells;
}