yii\widgets\Pjax::init PHP Method

init() public method

public init ( )
    public function init()
    {
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }
        if ($this->requiresPjax()) {
            ob_start();
            ob_implicit_flush(false);
            $view = $this->getView();
            $view->clear();
            $view->beginPage();
            $view->head();
            $view->beginBody();
            if ($view->title !== null) {
                echo Html::tag('title', Html::encode($view->title));
            }
        } else {
            $options = $this->options;
            $tag = ArrayHelper::remove($options, 'tag', 'div');
            echo Html::beginTag($tag, array_merge(['data-pjax-container' => '', 'data-pjax-push-state' => $this->enablePushState, 'data-pjax-replace-state' => $this->enableReplaceState, 'data-pjax-timeout' => $this->timeout, 'data-pjax-scrollto' => $this->scrollTo], $options));
        }
    }

Usage Example

示例#1
1
 public function init()
 {
     Html::addCssClass($this->options, 'dimmable');
     if (!$this->loader) {
         $this->loader = Elements::dimmer(Elements::loader(), ['class' => 'active inverted']);
     }
     parent::init();
 }
All Usage Examples Of yii\widgets\Pjax::init