public function HTTPStatusCode::render in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/area/HTTPStatusCode.php \Drupal\views\Plugin\views\area\HTTPStatusCode::render()
Render the area.
Parameters
bool $empty: (optional) Indicator if view result is empty or not. Defaults to FALSE.
Return value
array In any case we need a valid Drupal render array to return.
Overrides AreaPluginBase::render
File
- core/
modules/ views/ src/ Plugin/ views/ area/ HTTPStatusCode.php, line 60
Class
- HTTPStatusCode
- Alter the HTTP response status code used by the view.
Namespace
Drupal\views\Plugin\views\areaCode
public function render($empty = FALSE) {
if (!$empty || !empty($this->options['empty'])) {
$build['#attached']['http_header'][] = [
'Status',
$this->options['status_code'],
];
return $build;
}
}