BlogHelper::setContent PHP Method

setContent() public method

アイキャッチを利用する場合に必ず設定が必要
public setContent ( integer $blogContentId = null ) : void
$blogContentId integer ブログコンテンツID
return void
    public function setContent($blogContentId = null)
    {
        if (empty($this->blogContent)) {
            if ($blogContentId) {
                if (!empty($this->request->query['preview']) && $this->request->query['preview'] == 'default' && $this->request->data) {
                    if (!empty($this->request->data['BlogContent'])) {
                        $this->blogContent = $this->request->data['BlogContent'];
                    }
                } else {
                    $BlogContent = ClassRegistry::init('Blog.BlogContent');
                    $BlogContent->unbindModel(['hasMany' => ['BlogPost', 'BlogCategory']]);
                    $this->blogContent = Hash::extract($BlogContent->read(null, $blogContentId), 'BlogContent');
                }
            } elseif (isset($this->_View->viewVars['blogContent']['BlogContent'])) {
                $this->blogContent = $this->_View->viewVars['blogContent']['BlogContent'];
            }
        }
        if ($this->blogContent) {
            $BlogPost = ClassRegistry::init('Blog.BlogPost');
            $BlogPost->setupUpload($this->blogContent['id']);
        }
    }