/** * @inheritDoc BaseModel::defineAttributes() * * @return array */ protected function defineAttributes() { $attributes = array('ancestorDist' => AttributeType::Number, 'ancestorOf' => AttributeType::Mixed, 'archived' => AttributeType::Bool, 'dateCreated' => AttributeType::Mixed, 'dateUpdated' => AttributeType::Mixed, 'descendantDist' => AttributeType::Number, 'descendantOf' => AttributeType::Mixed, 'fixedOrder' => AttributeType::Bool, 'id' => AttributeType::Number, 'indexBy' => AttributeType::String, 'level' => AttributeType::Number, 'limit' => array(AttributeType::Number, 'default' => 100), 'locale' => AttributeType::Locale, 'localeEnabled' => array(AttributeType::Bool, 'default' => true), 'nextSiblingOf' => AttributeType::Mixed, 'offset' => array(AttributeType::Number, 'default' => 0), 'order' => array(AttributeType::String, 'default' => 'elements.dateCreated desc'), 'positionedAfter' => AttributeType::Mixed, 'positionedBefore' => AttributeType::Mixed, 'prevSiblingOf' => AttributeType::Mixed, 'relatedTo' => AttributeType::Mixed, 'ref' => AttributeType::String, 'search' => AttributeType::String, 'siblingOf' => AttributeType::Mixed, 'slug' => AttributeType::String, 'status' => array(AttributeType::String, 'default' => BaseElementModel::ENABLED), 'title' => AttributeType::String, 'uri' => AttributeType::String, 'kind' => AttributeType::Mixed, 'childField' => AttributeType::String, 'childOf' => AttributeType::Mixed, 'depth' => AttributeType::Number, 'parentField' => AttributeType::String, 'parentOf' => AttributeType::Mixed); // Mix in any custom attributes defined by the element type $elementTypeAttributes = $this->_elementType->defineCriteriaAttributes(); $attributes = array_merge($attributes, $elementTypeAttributes); return $attributes; }
/** * @return array */ protected function defineAttributes() { $attributes = array('ancestorDist' => AttributeType::Number, 'ancestorOf' => AttributeType::Mixed, 'archived' => AttributeType::Bool, 'dateCreated' => AttributeType::Mixed, 'dateUpdated' => AttributeType::Mixed, 'descendantDist' => AttributeType::Number, 'descendantOf' => AttributeType::Mixed, 'fixedOrder' => AttributeType::Bool, 'id' => AttributeType::Number, 'indexBy' => AttributeType::String, 'level' => AttributeType::Number, 'limit' => array(AttributeType::Number, 'default' => 100), 'locale' => AttributeType::Locale, 'localeEnabled' => array(AttributeType::Bool, 'default' => true), 'nextSiblingOf' => AttributeType::Mixed, 'offset' => array(AttributeType::Number, 'default' => 0), 'order' => array(AttributeType::String, 'default' => 'elements.dateCreated desc'), 'positionedAfter' => AttributeType::Mixed, 'positionedBefore' => AttributeType::Mixed, 'prevSiblingOf' => AttributeType::Mixed, 'relatedTo' => AttributeType::Mixed, 'ref' => AttributeType::String, 'search' => AttributeType::String, 'siblingOf' => AttributeType::Mixed, 'slug' => AttributeType::String, 'status' => array(AttributeType::String, 'default' => BaseElementModel::ENABLED), 'title' => AttributeType::String, 'uri' => AttributeType::String, 'kind' => AttributeType::Mixed, 'childField' => AttributeType::String, 'childOf' => AttributeType::Mixed, 'depth' => AttributeType::Number, 'parentField' => AttributeType::String, 'parentOf' => AttributeType::Mixed); // Mix in any custom attributes defined by the element type $elementTypeAttributes = $this->_elementType->defineCriteriaAttributes(); $attributes = array_merge($attributes, $elementTypeAttributes); // Mix in the custom fields $this->_supportedFieldHandles = array(); foreach (craft()->fields->getAllFields() as $field) { // Make sure the handle doesn't conflict with an existing attribute if (!isset($attributes[$field->handle])) { $this->_supportedFieldHandles[] = $field->handle; $attributes[$field->handle] = array(AttributeType::Mixed); } } return $attributes; }