web/View.php
public function loadBlock($name, $isGlobal = false)
    {
        if (is_null($name)) {
            throw new BadRequestHttpException('Block name not specified.');
        }

        $find = [
            'title' => $name,
        ];

        if ($isGlobal === false) {
            //if not global
            if (isset($this->params['block']['id'])) {
                $find['parent'] = $this->params['block']['id'];
            }
            if (isset($this->params['block']['layout'])) {
                $find['parent_layout'] = $this->params['block']['layout'];
            }

            if (isset($this->params['block']['slug'])) {
                //get parent page id
                /**
                 * @var $page \backend\models\Page
                 */
                if ($page = Page::findOne([
                    'slug' => $this->params['block']['slug'],
                ])) {
                    $find['parent'] = $page->id;
                }
            }
        }

        /**
         * @var $block \backend\models\Block
         */
        if ($block = Block::findOne($find)) {
            //if block found
            return $block->render();
        }

        return false;
    }
public function loadBlock($name, $isGlobal = false)
    {
        if (is_null($name)) {
            throw new BadRequestHttpException('Block name not specified.');
        }

        $find = [
            'title' => $name,
        ];

        if ($isGlobal === false) {
            //if not global
            if (isset($this->params['block']['id'])) {
                $find['parent'] = $this->params['block']['id'];
            }
            if (isset($this->params['block']['layout'])) {
                $find['parent_layout'] = $this->params['block']['layout'];
            }

            if (isset($this->params['block']['slug'])) {
                //get parent page id
                /**
                 * @var $page \backend\models\Page
                 */
                if ($page = Page::findOne([
                    'slug' => $this->params['block']['slug'],
                ])) {
                    $find['parent'] = $page->id;
                }
            }
        }

        /**
         * @var $block \backend\models\Block
         */
        if ($block = Block::findOne($find)) {
            //if block found
            return $block->render();
        }

        return false;
    }
finds and return content of requested block by name
@param $name
@param bool $isGlobal
@return bool|string
@throws BadRequestHttpException