private function _fieldWithAccessRules($model, $attribute, $options, $rule)
 {
     switch ($this->_verifyAccessRules($rule)) {
         case self::EDITABLE:
             return parent::field($model, $attribute, $options);
         case self::NONEDITABLE:
             return parent::field($model, $attribute, array_merge($options, ['template' => '{label}' . $model->{$attribute}]));
         case self::INVISIBLE:
             return;
     }
 }
示例#2
0
 /**
  * Generates a form field.
  * A form field is associated with a model and an attribute. It contains a label, an input and an error message
  * and use them to interact with end users to collect their inputs for the attribute.
  * @param Model $model the data model
  * @param string $attribute the attribute name or expression. See [[Html::getAttributeName()]] for the format
  * about attribute expression.
  * @param array $options the additional configurations for the field object
  * @return ActiveField the created ActiveField object
  * @see fieldConfig
  */
 public function field($model, $attribute, $options = [])
 {
     return parent::field($model, $attribute, $options);
 }