Elgg\ViewsService::renderViewFile PHP Method

renderViewFile() private method

Includes view PHP or static file
private renderViewFile ( string $view, array $vars, string $viewtype, boolean $issue_missing_notice ) : string | false
$view string The view name
$vars array Variables passed to view
$viewtype string The viewtype
$issue_missing_notice boolean Log a notice if the view is missing
return string | false output generated by view file inclusion or false
    private function renderViewFile($view, array $vars, $viewtype, $issue_missing_notice)
    {
        $file = $this->findViewFile($view, $viewtype);
        if (!$file) {
            if ($issue_missing_notice) {
                $this->logger->log("{$viewtype}/{$view} view does not exist.", 'NOTICE');
            }
            return false;
        }
        if (pathinfo($file, PATHINFO_EXTENSION) === 'php') {
            ob_start();
            // don't isolate, scripts use the local $vars
            include $file;
            return ob_get_clean();
        }
        return file_get_contents($file);
    }