Frontend\Modules\Blog\Actions\Detail::getData PHP Method

getData() private method

Load the data, don't forget to validate the incoming data
private getData ( )
    private function getData()
    {
        // validate incoming parameters
        if ($this->URL->getParameter(1) === null) {
            $this->redirect(FrontendNavigation::getURL(404));
        }
        // load revision
        if ($this->URL->getParameter('revision', 'int') != 0) {
            // get data
            $this->record = FrontendBlogModel::getRevision($this->URL->getParameter(1), $this->URL->getParameter('revision', 'int'));
            // add no-index, so the draft won't get accidentally indexed
            $this->header->addMetaData(array('name' => 'robots', 'content' => 'noindex, nofollow'), true);
        } else {
            // get by URL
            $this->record = FrontendBlogModel::get($this->URL->getParameter(1));
        }
        // anything found?
        if (empty($this->record)) {
            $this->redirect(FrontendNavigation::getURL(404));
        }
        // get comments
        $this->comments = FrontendBlogModel::getComments($this->record['id']);
        // get tags
        $this->record['tags'] = FrontendTagsModel::getForItem('Blog', $this->record['id']);
        // get settings
        $this->settings = $this->get('fork.settings')->getForModule('Blog');
        // overwrite URLs
        $this->record['category_full_url'] = FrontendNavigation::getURLForBlock('Blog', 'Category') . '/' . $this->record['category_url'];
        $this->record['full_url'] = FrontendNavigation::getURLForBlock('Blog', 'Detail') . '/' . $this->record['url'];
        $this->record['allow_comments'] = $this->record['allow_comments'] == 'Y';
        $this->record['comments_count'] = count($this->comments);
        // reset allow comments
        if (!$this->settings['allow_comments']) {
            $this->record['allow_comments'] = false;
        }
    }