function init() { // feed title $oContentField = new AnwContentFieldPage_string(self::FIELD_TITLE); $oContentField->indexAs(self::PUB_TITLE); $this->addContentField($oContentField); // feed description $oContentField = new AnwContentFieldPage_xhtml(self::FIELD_DESCRIPTION); $this->addContentField($oContentField); // feed match $oContentField = new AnwContentFieldPage_string(self::FIELD_MATCH); $oContentField->setDefaultValue('*'); $oContentField->setTranslatable(false); $oContentField->addForbiddenPattern('/^$/'); $oContentMultiplicity = new AnwContentMultiplicity_multiple(); $oContentMultiplicity->setSortable(false); $oContentField->setMultiplicity($oContentMultiplicity); $this->addContentField($oContentField); // feed contentclass $oContentField = new AnwContentFieldPage_checkboxGroup(self::FIELD_CONTENTCLASS); $oContentField->setTranslatable(false); $asEnumValues = array(); $aoContentClasses = AnwContentClasses::getContentClasses(); foreach ($aoContentClasses as $oContentClass) { $asEnumValues[$oContentClass->getName()] = $oContentClass->getName(); } $oContentField->setEnumValues($asEnumValues); $oContentMultiplicity = new AnwContentMultiplicity_multiple(); $oContentMultiplicity->setSortable(false); $oContentField->setMultiplicity($oContentMultiplicity); $this->addContentField($oContentField); // feed limit $oContentField = new AnwContentFieldPage_integer(self::FIELD_LIMIT); $oContentField->setTranslatable(false); $oContentField->setDefaultValue(15); $oContentField->setValueMin(1); $oContentField->setValueMax(50); $this->addContentField($oContentField); }
function initDatatype() { $oDatatype = parent::initDatatype(); //set enum values $nFetchingLimit = 0; $aoPages = AnwStorage::fetchPagesByClass($this->asFetchingPatterns, $this->oFetchingContentClass, $this->asFetchingLangs, $nFetchingLimit, $this->sFetchingSort, $this->sFetchingSortOrder, $this->asFetchingFilters); $asEnumValues = array(); foreach ($aoPages as $oPage) { //use pageId as field value, so that pages can be renamed without loosing enum values $asEnumValues[$oPage->getPageGroup()->getId()] = $oPage->getName(); } $oDatatype->setEnumValues($asEnumValues); return $oDatatype; }