Airship\Cabin\Hull\Landing\CustomPages::render PHP Method

render() protected method

Render a custom page
protected render ( array $latest ) : string
$latest array
return string
    protected function render(array $latest) : string
    {
        $state = State::instance();
        switch ($latest['formatting']) {
            case 'Markdown':
                $md = new CommonMarkConverter();
                if (empty($latest['raw'])) {
                    $state->HTMLPurifier->purify($md->convertToHtml($latest['body']));
                }
                return $md->convertToHtml($latest['body']);
            case 'RST':
                $rst = (new RSTParser())->setIncludePolicy(false);
                if (empty($latest['raw'])) {
                    $state->HTMLPurifier->purify((string) $rst->parse($latest['body']));
                }
                return (string) $rst->parse($latest['body']);
            case 'HTML':
            case 'Rich Text':
            default:
                if (empty($latest['raw'])) {
                    return $state->HTMLPurifier->purify($latest['body']);
                }
                return $latest['body'];
        }
    }