/**
  * Returns HAS_ONE relation attributes
  * and non-relation attributes in an array
  * mapping attribute names to 'attributeLabel' to the
  * attribute label.  Also returns 'isRequired' and 'isAudited' information.
  */
 public function getAttributes()
 {
     $attributes = array();
     ModelAttributeCollectionUtil::populateCollection($attributes, 'id', $this->model->getAttributeLabel('id'), 'Text');
     $modelMetadata = $this->model->getMetadata();
     foreach ($this->model->attributeNames() as $attributeName) {
         if (!$this->model->isRelation($attributeName) || $this->model->getRelationType($attributeName) == RedBeanModel::HAS_ONE || $this->model->getRelationType($attributeName) == RedBeanModel::HAS_MANY_BELONGS_TO) {
             if ($this->model instanceof Item) {
                 $isAudited = $this->model->isAttributeAudited($attributeName);
             } else {
                 $isAudited = false;
             }
             $customFieldName = null;
             if ($this->model->isRelation($attributeName) && $this->model->{$attributeName} instanceof BaseCustomField) {
                 foreach ($modelMetadata as $modelClassName => $modelClassMetadata) {
                     if (isset($modelMetadata[$modelClassName]['customFields']) && isset($modelMetadata[$modelClassName]['customFields'][$attributeName])) {
                         $customFieldName = $modelMetadata[$modelClassName]['customFields'][$attributeName];
                     }
                 }
             }
             ModelAttributeCollectionUtil::populateCollection($attributes, $attributeName, $this->model->getAttributeLabel($attributeName), ModelAttributeToDesignerTypeUtil::getDesignerType($this->model, $attributeName), $this->model->isAttributeRequired($attributeName), $this->model->isAttributeReadOnly($attributeName), $isAudited, $customFieldName);
         }
     }
     return $attributes;
 }
 protected function getFormAttributes()
 {
     $attributes = array();
     foreach ($this->model->getSearchableAttributes() as $attributeName => $notUsed) {
         ModelAttributeCollectionUtil::populateCollection($attributes, $attributeName, $this->model->getAttributeLabel($attributeName), ModelFormAttributeToDesignerTypeUtil::getDesignerType($this->model, $attributeName));
     }
     return $attributes;
 }
 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;
 }
 /**
  * @return array of place-able attributes
  */
 public function getAttributes()
 {
     $attributes = array();
     foreach ($this->model->attributeNames() as $attributeName) {
         if (!$this->model->isRelation($attributeName) || $this->model->isOwnedRelation($attributeName) && $this->model->getRelationType($attributeName) == RedBeanModel::HAS_ONE) {
             if ($this->model instanceof Item) {
                 $isAudited = $this->model->isAttributeAudited($attributeName);
             } else {
                 $isAudited = false;
             }
             ModelAttributeCollectionUtil::populateCollection($attributes, $attributeName, $this->model->getAttributeLabel($attributeName), ModelAttributeToDesignerTypeUtil::getDesignerType($this->model, $attributeName), $this->model->isAttributeRequired($attributeName), $this->model->isAttributeReadOnly($attributeName), $isAudited);
         }
     }
     return $attributes;
 }