Example #1
0
 public function beginTag($options = [])
 {
     $options['id'] = isset($options['id']) ? $options['id'] : $this->id;
     $persisthide = \stivehu\enhancedcookie\EnhancedCookie::getBigCookie($this->id);
     $options['style'] = $persisthide === '1' ? '' : 'display:none';
     return \yii\helpers\Html::beginTag($this->_tag, $options);
 }
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->checkboxOptions instanceof Closure) {
         $options = call_user_func($this->checkboxOptions, $model, $key, $index, $this);
     } else {
         $options = $this->checkboxOptions;
         if (!isset($options['value'])) {
             $options['value'] = is_array($key) ? json_encode($key, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : $key;
         }
     }
     $checked = false;
     if ($selectedItem = \stivehu\rangecomp\Rangecomp::rangeDeCompress(Json::decode(\stivehu\enhancedcookie\EnhancedCookie::getBigCookie($this->cookieName)))) {
         if (in_array($model->id, $selectedItem)) {
             $checked = true;
         }
     }
     return Html::checkbox($this->name, $checked, $options);
 }