当前位置: 首页>>代码示例>>PHP>>正文


PHP DatagridConfiguration::offsetSet方法代码示例

本文整理汇总了PHP中Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration::offsetSet方法的典型用法代码示例。如果您正苦于以下问题:PHP DatagridConfiguration::offsetSet方法的具体用法?PHP DatagridConfiguration::offsetSet怎么用?PHP DatagridConfiguration::offsetSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration的用法示例。


在下文中一共展示了DatagridConfiguration::offsetSet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processConfigs

 /**
  * Validate configs nad fill default values
  *
  * @param DatagridConfiguration $config
  */
 public function processConfigs(DatagridConfiguration $config)
 {
     $configItems = $config->offsetGetOr(Configuration::BASE_CONFIG_KEY, []);
     $configuration = new Configuration(Configuration::BASE_CONFIG_KEY);
     $normalizedConfigItems = $this->validateConfiguration($configuration, [Configuration::BASE_CONFIG_KEY => $configItems]);
     $isGranted = $this->securityFacade->isGranted('EDIT', 'entity:' . $configItems['entity_name']);
     //according to ACL disable inline editing for the whole grid
     if (!$isGranted) {
         $normalizedConfigItems[Configuration::CONFIG_KEY_ENABLE] = false;
     }
     // replace config values by normalized, extra keys passed directly
     $resultConfigItems = array_replace_recursive($configItems, $normalizedConfigItems);
     if (is_null($resultConfigItems['save_api_accessor']['default_route_parameters']['className'])) {
         $resultConfigItems['save_api_accessor']['default_route_parameters']['className'] = $this->entityClassNameHelper->getUrlSafeClassName($configItems['entity_name']);
     }
     $config->offsetSet(Configuration::BASE_CONFIG_KEY, $resultConfigItems);
     //add inline editing where it is possible, do not use ACL, because additional parameters for columns needed
     $columns = $config->offsetGetOr(FormatterConfiguration::COLUMNS_KEY, []);
     $blackList = $configuration->getBlackList();
     foreach ($columns as $columnName => &$column) {
         if (!in_array($columnName, $blackList)) {
             $newColumn = $this->guesser->getColumnOptions($columnName, $configItems['entity_name'], $column);
             //frontend type key must not be replaced with default value
             $typeKey = PropertyInterface::FRONTEND_TYPE_KEY;
             if (!empty($newColumn[$typeKey])) {
                 $column[$typeKey] = $newColumn[$typeKey];
             }
             $column = array_replace_recursive($newColumn, $column);
         }
     }
     $config->offsetSet(FormatterConfiguration::COLUMNS_KEY, $columns);
 }
开发者ID:kstupak,项目名称:platform,代码行数:37,代码来源:InlineEditingExtension.php

示例2: configure

 /**
  * {@inheritdoc}
  */
 public function configure(DatagridConfiguration $configuration)
 {
     $attributes = $configuration->offsetGet(self::SOURCE_KEY)[self::USEABLE_ATTRIBUTES_KEY];
     $attributes = $attributes === null ? [] : $attributes;
     $displayedFilters = [];
     foreach ($attributes as $attributeCode => $attribute) {
         if (!$attribute['useableAsGridFilter']) {
             continue;
         }
         $attributeType = $attribute['attributeType'];
         $attributeTypeConf = $this->registry->getConfiguration($attributeType);
         if (!$attributeTypeConf || !isset($attributeTypeConf['filter'])) {
             throw new \LogicException(sprintf('Attribute type %s must be configured to allow grid filter on attribute %s', $attributeType, $attributeCode));
         }
         $filterConfig = $attributeTypeConf['filter'];
         $filterConfig = $filterConfig + [ProductFilterUtility::DATA_NAME_KEY => $attributeCode, 'label' => $attribute['label'], 'enabled' => AttributeTypes::IDENTIFIER === $attributeType, 'order' => $attribute['sortOrder'], 'group' => $attribute['group'], 'groupOrder' => $attribute['groupOrder']];
         if (AttributeTypes::METRIC === $attributeType) {
             $filterConfig['family'] = $attribute['metricFamily'];
         }
         $displayedFilters[$attributeCode] = $filterConfig;
     }
     $this->sortFilters($displayedFilters);
     $filters = $configuration->offsetGet(FilterConfiguration::FILTERS_KEY);
     foreach ($displayedFilters as $attributeCode => $filterConfig) {
         $filters['columns'][$attributeCode] = $filterConfig;
     }
     $configuration->offsetSet(FilterConfiguration::FILTERS_KEY, $filters);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:31,代码来源:FiltersConfigurator.php

示例3: processConfigs

 /**
  * Validate configs nad fill default values
  *
  * @param DatagridConfiguration $config
  */
 public function processConfigs(DatagridConfiguration $config)
 {
     $columns = $config->offsetGetOr(Configuration::COLUMNS_KEY, []);
     $properties = $config->offsetGetOr(Configuration::PROPERTIES_KEY, []);
     // validate extension configuration and normalize by setting default values
     $columnsNormalized = $this->validateConfigurationByType($columns, Configuration::COLUMNS_KEY);
     $propertiesNormalized = $this->validateConfigurationByType($properties, Configuration::PROPERTIES_KEY);
     // replace config values by normalized, extra keys passed directly
     $config->offsetSet(Configuration::COLUMNS_KEY, array_replace_recursive($columns, $columnsNormalized))->offsetSet(Configuration::PROPERTIES_KEY, array_replace_recursive($properties, $propertiesNormalized));
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:15,代码来源:FormatterExtension.php

示例4:

 function it_configures_datagrid_filters(DatagridConfiguration $configuration, $registry)
 {
     $attributes = ['sku' => ['code' => 'sku', 'label' => 'Sku', 'useableAsGridFilter' => 1, 'attributeType' => 'pim_catalog_identifier', 'sortOrder' => 1, 'group' => 'General', 'groupOrder' => 1], 'name' => ['code' => 'name', 'label' => 'Name', 'useableAsGridFilter' => 1, 'attributeType' => 'pim_catalog_text', 'sortOrder' => 2, 'group' => 'General', 'groupOrder' => 1]];
     $attributesConf = [ContextConfigurator::USEABLE_ATTRIBUTES_KEY => $attributes];
     $configuration->offsetGet(ContextConfigurator::SOURCE_KEY)->willReturn($attributesConf);
     $configuration->offsetGet(FilterConfiguration::FILTERS_KEY)->willReturn([]);
     $registry->getConfiguration('pim_catalog_identifier')->willReturn(['filter' => ['identifier_config']]);
     $registry->getConfiguration('pim_catalog_text')->willReturn(['filter' => ['text_config']]);
     $expectedConf = ['sku' => [0 => 'identifier_config', 'data_name' => 'sku', 'label' => 'Sku', 'enabled' => true, 'order' => 1, 'group' => 'General', 'groupOrder' => 1], 'name' => [0 => 'text_config', 'data_name' => 'name', 'label' => 'Name', 'enabled' => false, 'order' => 2, 'group' => 'General', 'groupOrder' => 1]];
     $configuration->offsetSet(FilterConfiguration::FILTERS_KEY, ['columns' => $expectedConf])->shouldBeCalled();
     $this->configure($configuration);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:12,代码来源:FiltersConfiguratorSpec.php

示例5: addEntityConfigProperties

 /**
  * @param DatagridConfiguration $config
  * @param                       $itemType
  */
 protected function addEntityConfigProperties(DatagridConfiguration $config, $itemType)
 {
     // configure properties from config providers
     $properties = $config->offsetGetOr(Configuration::PROPERTIES_KEY, []);
     $columns = $config->offsetGetByPath(self::PATH_COLUMNS, []);
     $actions = [];
     $providers = $this->configManager->getProviders();
     foreach ($providers as $provider) {
         $gridActions = $provider->getPropertyConfig()->getGridActions($itemType);
         if (!empty($gridActions)) {
             $this->prepareProperties($gridActions, $columns, $properties, $actions);
         }
     }
     if (count($actions)) {
         $config->offsetSet(ActionExtension::ACTION_CONFIGURATION_KEY, $this->getActionConfigurationClosure($actions));
     }
     $config->offsetSet(Configuration::PROPERTIES_KEY, $properties);
 }
开发者ID:snorchel,项目名称:platform,代码行数:22,代码来源:AbstractConfigGridListener.php

示例6: addEntityConfigProperties

 /**
  * @param DatagridConfiguration $config
  * @param                       $itemType
  */
 protected function addEntityConfigProperties(DatagridConfiguration $config, $itemType)
 {
     // configure properties from config providers
     $properties = $config->offsetGetOr(Configuration::PROPERTIES_KEY, []);
     $filters = [];
     $actions = [];
     $providers = $this->configManager->getProviders();
     foreach ($providers as $provider) {
         $gridActions = $provider->getPropertyConfig()->getGridActions($itemType);
         $this->prepareProperties($gridActions, $properties, $actions, $filters);
         // TODO: check if this neccessary for field config grid
         if (static::GRID_NAME == 'entityconfig-grid' && $provider->getPropertyConfig()->getUpdateActionFilter()) {
             $filters['update'] = $provider->getPropertyConfig()->getUpdateActionFilter();
         }
     }
     if (count($filters)) {
         $config->offsetSet(ActionExtension::ACTION_CONFIGURATION_KEY, $this->getActionConfigurationClosure($filters, $actions));
     }
     $config->offsetSet(Configuration::PROPERTIES_KEY, $properties);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:24,代码来源:AbstractConfigGridListener.php


注:本文中的Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration::offsetSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。