function getValuesFromPost($sSuffix) { $asFieldValues = parent::getValuesFromPost($sSuffix); try { // rebuild selectioned valid components list, with same indices as original values $aoComponents = array(); foreach ($asFieldValues as $i => $sComponentName) { try { $this->testContentFieldValueAtomic($sComponentName); $aoComponents[$i] = AnwComponent::loadComponentGeneric($sComponentName, $this->mComponentType); } catch (Exception $e) { // just ignore this erroneous value... } } // solve dependancies foreach ($aoComponents as $oComponent) { if ($oComponent instanceof AnwDependancyManageable) { $aoDependancies = $oComponent->getComponentDependancies(); foreach ($aoDependancies as $oDependancy) { $asFieldValues = $oDependancy->solveDependancies($aoComponents, $asFieldValues); } } } } catch (Exception $e) { // if dependancies can't be solved, contentfield will appear as erroneous, but we can't throw exception here } return $asFieldValues; }
function init() { parent::init(); //lang policy $oContentField = new AnwContentFieldSettings_radio(self::FIELD_POLICY); $asEnumValues = array(self::POLICY_ALL_LANGS => $this->getComponent()->t_contentfieldsettings("policy_all_langs"), self::POLICY_SELECTED_LANGS => $this->getComponent()->t_contentfieldsettings("policy_selected_langs")); $oContentField->setEnumValues($asEnumValues); $oContentField->setDefaultValue(self::POLICY_ALL_LANGS); $this->addContentField($oContentField); //langs selection $oContentField = new AnwContentFieldSettings_checkboxGroup(self::FIELD_LANGS); $asLangs = AnwComponent::globalCfgLangs(); $asEnumValues = array(); foreach ($asLangs as $sLang) { $sLangName = $sLang . " - " . Anwi18n::langName($sLang); $asEnumValues[$sLang] = $sLangName; } $oContentField->setEnumValues($asEnumValues); $oMultiplicity = new AnwContentMultiplicity_multiple(); $oMultiplicity->setSortable(false); $oContentField->setMultiplicity($oMultiplicity); $this->addContentField($oContentField); }