public function render($view = null, $layout = null)
    {
        $content = parent::render($view, $layout);

        if (version_compare(Configure::version(), '3.6.0', '<')) {
            $type = $this->response->type();
        } else {
            $type = $this->response->getType();
        }

        if ($type === 'text/html') {
            return $content;
        }
        if ($this->renderer() === null) {
            $this->response = $this->response->withType('html');

            return $content;
        }

        if (!empty($this->pdfConfig['filename']) || !empty($this->pdfConfig['download'])) {
            $this->response = $this->response->withDownload($this->getFilename());
        }

        $this->Blocks->set('content', $this->renderer()->output($content));

        return $this->Blocks->get('content');
    }