本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\Provider\ConfigProvider::getPropertyConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigProvider::getPropertyConfig方法的具体用法?PHP ConfigProvider::getPropertyConfig怎么用?PHP ConfigProvider::getPropertyConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityConfigBundle\Provider\ConfigProvider
的用法示例。
在下文中一共展示了ConfigProvider::getPropertyConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processData
/**
* @param ConfigProvider $provider
* @param ConfigInterface $config
* @param array $data
* @param string $state
* @return array
*/
protected function processData(ConfigProvider $provider, ConfigInterface $config, array $data, $state)
{
if ($provider->getScope() === 'enum' && $config->get('enum_code')) {
return [];
}
$translatable = $provider->getPropertyConfig()->getTranslatableValues($config->getId());
$translations = [];
foreach ($data as $code => $value) {
if (in_array($code, $translatable, true)) {
// check if a label text was changed
$labelKey = $config->get($code);
if ($state === ExtendScope::STATE_NEW || !$this->translationHelper->isTranslationEqual($labelKey, $value)) {
$translations[$labelKey] = $value;
}
// replace label text with label name in $value variable
$value = $labelKey;
}
$config->set($code, $value);
}
$this->configManager->persist($config);
return $translations;
}
示例2: getFormBlockConfig
/**
* @param ConfigProvider $configProvider
* @param string $configType
* @return array
*/
protected function getFormBlockConfig(ConfigProvider $configProvider, $configType)
{
$result = (array) $configProvider->getPropertyConfig()->getFormBlockConfig($configType);
$this->applyFormBlockConfigTranslations($result);
return $result;
}
示例3: getFieldDefaultValues
/**
* Extracts field default values from an annotation and config file
*
* @param ConfigProvider $provider
* @param string $className
* @param string $fieldName
* @param string $fieldType
* @param FieldMetadata|null $metadata
* @return array
*/
protected function getFieldDefaultValues(ConfigProvider $provider, $className, $fieldName, $fieldType, $metadata = null)
{
$defaultValues = [];
$scope = $provider->getScope();
// try to get default values from an annotation
if ($metadata && isset($metadata->defaultValues[$scope])) {
$defaultValues = $metadata->defaultValues[$scope];
}
// combine them with default values from a config file
$defaultValues = array_merge($provider->getPropertyConfig()->getDefaultValues(PropertyConfigContainer::TYPE_FIELD, $fieldType), $defaultValues);
// process translatable values
$translatablePropertyNames = $provider->getPropertyConfig()->getTranslatableValues(PropertyConfigContainer::TYPE_FIELD);
foreach ($translatablePropertyNames as $propertyName) {
if (empty($defaultValues[$propertyName])) {
$defaultValues[$propertyName] = ConfigHelper::getTranslationKey($scope, $propertyName, $className, $fieldName);
}
}
return $defaultValues;
}