/** * @return EavModel */ public function __get($name = '') { /*if (!$this->EavModel instanceof EavModel) { }*/ $this->EavModel = EavModel::create(['entityModel' => $this->owner, 'valueClass' => $this->valueClass, 'attribute' => $name]); return $this->EavModel; }
private function renderField($model, $attribute, $options) { $this->adjustLabelFor($options); $eavModel = EavModel::create(['entityModel' => $model, 'attribute' => $attribute, 'valueClass' => \mirocow\eav\models\EavAttributeValue::className()]); $handler = $eavModel->handlers[$attribute]; $handler->owner->activeForm = $options['form']; unset($options['form']); $handler->options = $options; /** @var EavAttribute $attributeModel */ $attributeModel = $handler->attributeModel; /** @var ActiveField $model */ $model = $handler->run(); $model->label($attributeModel->label); $model->hint($attributeModel->description); $this->parts = $model->parts; /** Add required attribute */ if ($attributeModel->required) { $this->options['class'] .= ' ' . $this->form->requiredCssClass; } return $this; }
/** * @return EavModel */ public function __get($name = '') { return $this->EavModel = EavModel::create(['entityModel' => $this->owner, 'valueClass' => $this->valueClass, 'attribute' => $name]); }