while ($arEvent = $typeBuildEvents->Fetch()) { $typeDescription = ExecuteModuleEventEx($arEvent); if (!$typeDescription['name']) { continue; } if (!$typeDescription['variants'] || !is_array($typeDescription['variants']) || empty($typeDescription['variants'])) { continue; } $tName = $typeDescription['name']; $jsParams['types'][$tName] = ' * ' . $tName; foreach ($typeDescription['variants'] as $tVariantValue => $tVariantName) { $jsParams['customLists'][$tName][$tVariantValue] = $tVariantName; } } foreach (WS_PSettings::getFieldsList() as $fieldName) { $field = WS_PSettings::getField($fieldName); if (!$jsParams['types'][$field->getType()]) { continue; } $value = $field->getValue(); $default = $field->getDefault(); $fData = array('label' => $field->getLabel(), 'name' => $field->getName(), 'type' => $field->getType(), 'value' => $value, 'isMany' => $field->isMany(), 'sort' => $field->getSort(), 'default' => $default, 'variants' => array()); if ($field->getType() == WS_PSettings::FIELD_TYPE_LIST) { $fData['variants'] = $field->getVariants(); $variants = array(); foreach ($fData['variants'] as $value => $name) { $variants[$value] = $name; } } $jsParams['fields'][$field->getName()] = $fData; }
/** * @return WS_PSettings */ private static function _getInstance() { if (!self::$_self) { self::$_self = new self(); } return self::$_self; }