function HTTPStatusCode::render

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/area/HTTPStatusCode.php \Drupal\views\Plugin\views\area\HTTPStatusCode::render()
  2. 8.9.x core/modules/views/src/Plugin/views/area/HTTPStatusCode.php \Drupal\views\Plugin\views\area\HTTPStatusCode::render()
  3. 11.x core/modules/views/src/Plugin/views/area/HTTPStatusCode.php \Drupal\views\Plugin\views\area\HTTPStatusCode::render()

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\area

Code

public function render($empty = FALSE) {
    if (!$empty || !empty($this->options['empty'])) {
        $build['#attached']['http_header'][] = [
            'Status',
            $this->options['status_code'],
        ];
        return $build;
    }
}

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