skeeks\cms\base\Widget::run PHP Method

run() public method

public run ( ) : string
return string
    public function run()
    {
        if (YII_ENV == 'prod') {
            try {
                \Yii::beginProfile("Run: " . $this->_token);
                $content = $this->_run();
                \Yii::endProfile("Run: " . $this->_token);
            } catch (\Exception $e) {
                $content = \Yii::t('skeeks/cms', 'Error widget {class}', ['class' => $this->className()]) . " (" . $this->descriptor->name . "): " . $e->getMessage();
            }
        } else {
            \Yii::beginProfile("Run: " . $this->_token);
            $content = $this->_run();
            \Yii::endProfile("Run: " . $this->_token);
        }
        if ($this->_isBegin) {
            $result = $content;
        } else {
            $result = $this->_begin();
            $result .= $content;
            $result .= $this->_end();
        }
        return $result;
    }

Usage Example

Esempio n. 1
0
 public function run()
 {
     if ($this->_isBegin) {
         $this->_obContent = ob_get_clean();
         if (!$this->text) {
             $this->text = $this->_obContent;
         }
     }
     return parent::run();
 }