/** * Returns the element or attribute form type * that should be used with the named attribute * of the given model, (the name minus the Element * or AttributeForm suffix). */ public static function getDesignerType($model, $attributeName) { if (!$model->isAttribute($attributeName)) { return DerivedAttributeToMixedTypeUtil::getType(get_class($model), $attributeName); } return ModelAttributeToMixedTypeUtil::getType($model, $attributeName); }
public function getAttributes() { $attributes = array(); $calculatedAttributes = CalculatedDerivedAttributeMetadata::getAllByModelClassName($this->modelClassName); foreach ($calculatedAttributes as $attribute) { ModelAttributeCollectionUtil::populateCollection($attributes, $attribute->name, $attribute->getLabelByLanguage(Yii::app()->language), DerivedAttributeToMixedTypeUtil::getType($this->modelClassName, $attribute->name)); } $dropdownDependencyAttributes = DropDownDependencyDerivedAttributeMetadata::getAllByModelClassName($this->modelClassName); foreach ($dropdownDependencyAttributes as $attribute) { ModelAttributeCollectionUtil::populateCollection($attributes, $attribute->name, $attribute->getLabelByLanguage(Yii::app()->language), DerivedAttributeToMixedTypeUtil::getType($this->modelClassName, $attribute->name)); } return $attributes; }