protected function getClientOptions()
 {
     $options = [];
     $attribute = Html::getAttributeName($this->attribute);
     if (!in_array($attribute, $this->model->activeAttributes(), true)) {
         return [];
     }
     $validators = [];
     foreach ($this->model->getActiveValidators($attribute) as $validator) {
         /* @var $validator \yii\validators\Validator */
         $js = $validator->clientValidateAttribute($this->model, $attribute, $this->form->getView());
         if ($validator->enableClientValidation && $js != '') {
             if ($validator->whenClient !== null) {
                 $js = "if (({$validator->whenClient})(attribute, value)) { {$js} }";
             }
             $validators[] = $js;
         }
     }
     if (!empty($validators)) {
         $options['validate_extra'] = new JsExpression("function (attribute, value, messages, deferred, \$form) {" . implode('', $validators) . '}');
     }
     return array_merge($options, parent::getClientOptions());
 }
 /**
  * @param string|null $label the label or null to use model label
  * @param array $options the tag options
  */
 protected function renderLabelParts($label = null, $options = [])
 {
     $options = array_merge($this->labelOptions, $options);
     if ($label === null) {
         if (isset($options['label'])) {
             $label = $options['label'];
             unset($options['label']);
         } else {
             $attribute = Html::getAttributeName($this->attribute);
             $label = Html::encode($this->model->getAttributeLabel($attribute));
         }
     }
     if (!isset($options['for'])) {
         $options['for'] = Html::getInputId($this->model, $this->attribute);
     }
     $this->parts['{beginLabel}'] = Html::beginTag('label', $options);
     $this->parts['{endLabel}'] = Html::endTag('label');
     if (!isset($this->parts['{labelTitle}'])) {
         $this->parts['{labelTitle}'] = $label;
     }
 }