Example #1
0
 /**
  * Initializes the widget.
  * If you override this method, make sure you call the parent implementation first.
  */
 public function init()
 {
     if ($this->name === null && !$this->hasModel()) {
         throw new InvalidConfigException("Either 'name', or 'model' and 'attribute' properties must be specified.");
     }
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
     }
     parent::init();
 }
 /**
  * Initializes the FragmentCache object.
  */
 public function init()
 {
     parent::init();
     $this->cache = $this->enabled ? Instance::ensure($this->cache, Cache::className()) : null;
     if ($this->cache instanceof Cache && $this->getCachedContent() === false) {
         $this->getView()->cacheStack[] = $this;
         ob_start();
         ob_implicit_flush(false);
     }
 }