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


PHP DatagridConfiguration::offsetGetOr方法代码示例

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


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

示例1: build

 /**
  * Create, configure and build datagrid
  *
  * @param DatagridConfiguration $config
  * @param ParameterBag          $parameters
  *
  * @return DatagridInterface
  */
 public function build(DatagridConfiguration $config, ParameterBag $parameters)
 {
     /**
      * @TODO: should be refactored in BAP-6849
      */
     $minified = $parameters->get(ParameterBag::MINIFIED_PARAMETERS);
     if (is_array($minified) && array_key_exists('g', $minified) && is_array($minified['g'])) {
         $gridParams = [];
         foreach ($minified['g'] as $gridParamName => $gridParamValue) {
             $gridParams[$gridParamName] = $gridParamValue;
         }
         $parameters->add($gridParams);
     }
     /**
      * @TODO: should be refactored in BAP-6826
      */
     $event = new PreBuild($config, $parameters);
     $this->eventDispatcher->dispatch(PreBuild::NAME, $event);
     $class = $config->offsetGetByPath(self::BASE_DATAGRID_CLASS_PATH, $this->baseDatagridClass);
     $name = $config->getName();
     /** @var DatagridInterface $datagrid */
     $datagrid = new $class($name, $config, $parameters);
     $datagrid->setScope($config->offsetGetOr('scope'));
     $event = new BuildBefore($datagrid, $config);
     $this->eventDispatcher->dispatch(BuildBefore::NAME, $event);
     $acceptor = $this->createAcceptor($config, $parameters);
     $datagrid->setAcceptor($acceptor);
     $this->buildDataSource($datagrid, $config);
     $acceptor->processConfiguration();
     $event = new BuildAfter($datagrid);
     $this->eventDispatcher->dispatch(BuildAfter::NAME, $event);
     return $datagrid;
 }
开发者ID:Maksold,项目名称:platform,代码行数:41,代码来源:Builder.php

示例2: visitMetadata

 /**
  * {@inheritDoc}
  */
 public function visitMetadata(DatagridConfiguration $config, MetadataObject $data)
 {
     $params = $this->getParameters()->get(ParameterBag::ADDITIONAL_PARAMETERS, []);
     $currentView = isset($params[self::VIEWS_PARAM_KEY]) ? $params[self::VIEWS_PARAM_KEY] : null;
     $data->offsetAddToArray('initialState', ['gridView' => '__all__']);
     $data->offsetAddToArray('state', ['gridView' => $currentView]);
     $allLabel = null;
     if (isset($config['options']) && isset($config['options']['gridViews']) && isset($config['options']['gridViews']['allLabel'])) {
         $allLabel = $this->translator->trans($config['options']['gridViews']['allLabel']);
     }
     /** @var AbstractViewsList $list */
     $list = $config->offsetGetOr(self::VIEWS_LIST_KEY, false);
     $gridViews = ['choices' => [['label' => $allLabel, 'value' => '__all__']], 'views' => [(new View('__all__'))->getMetadata()]];
     if ($list !== false) {
         $configuredGridViews = $list->getMetadata();
         $configuredGridViews['views'] = array_merge($gridViews['views'], $configuredGridViews['views']);
         $configuredGridViews['choices'] = array_merge($gridViews['choices'], $configuredGridViews['choices']);
         $gridViews = $configuredGridViews;
     }
     if ($this->eventDispatcher->hasListeners(GridViewsLoadEvent::EVENT_NAME)) {
         $event = new GridViewsLoadEvent($config->getName(), $gridViews);
         $this->eventDispatcher->dispatch(GridViewsLoadEvent::EVENT_NAME, $event);
         $gridViews = $event->getGridViews();
     }
     $gridViews['gridName'] = $config->getName();
     $gridViews['permissions'] = $this->getPermissions();
     $data->offsetSet('gridViews', $gridViews);
 }
开发者ID:northdakota,项目名称:platform,代码行数:31,代码来源:GridViewsExtension.php

示例3: visitMetadata

 /**
  * {@inheritDoc}
  */
 public function visitMetadata(DatagridConfiguration $config, MetadataObject $data)
 {
     $params = $this->getRequestParams()->get(RequestParameters::ADDITIONAL_PARAMETERS);
     $currentView = isset($params[self::VIEWS_PARAM_KEY]) ? $params[self::VIEWS_PARAM_KEY] : null;
     $data->offsetAddToArray('state', ['gridView' => $currentView]);
     /** @var AbstractViewsList $list */
     $list = $config->offsetGetOr(self::VIEWS_LIST_KEY, false);
     if ($list !== false) {
         $data->offsetSet('gridViews', $list->getMetadata());
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:14,代码来源:GridViewsExtension.php

示例4: visitMetadata

 /**
  * {@inheritDoc}
  */
 public function visitMetadata(DatagridConfiguration $config, MetadataObject $data)
 {
     // get only columns here because columns will be represented on frontend
     $columns = $config->offsetGetOr(Configuration::COLUMNS_KEY, []);
     $propertiesMetadata = [];
     foreach ($columns as $name => $fieldConfig) {
         $fieldConfig = PropertyConfiguration::createNamed($name, $fieldConfig);
         $metadata = $this->getPropertyObject($fieldConfig)->getMetadata();
         // translate label on backend
         $metadata['label'] = $this->translator->trans($metadata['label']);
         $propertiesMetadata[] = $metadata;
     }
     $data->offsetAddToArray('columns', $propertiesMetadata);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:17,代码来源:FormatterExtension.php

示例5: getActionsMetadata

 /**
  * @param DatagridConfiguration $config
  * @return array
  */
 protected function getActionsMetadata(DatagridConfiguration $config)
 {
     $actionsMetadata = [];
     $actions = $config->offsetGetOr(static::ACTION_KEY, []);
     foreach ($actions as $name => $action) {
         $action = $this->getActionObject($name, $action);
         if ($action !== false) {
             $metadata = $action->getOptions()->toArray([], static::$excludeParams);
             $metadata['label'] = isset($metadata['label']) ? $this->translator->trans($metadata['label']) : null;
             $actionsMetadata[$action->getName()] = $metadata;
         }
     }
     return $actionsMetadata;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:18,代码来源:ActionExtension.php

示例6: visitMetadata

 /**
  * {@inheritDoc}
  */
 public function visitMetadata(DatagridConfiguration $config, MetadataObject $data)
 {
     $actionsMetadata = [];
     $actions = $config->offsetGetOr(static::ACTION_KEY, []);
     foreach ($actions as $name => $action) {
         $action = $this->getActionObject($name, $action);
         if ($action !== false) {
             $metadata = $action->getOptions()->toArray([], static::$excludeParams);
             $metadata['label'] = isset($metadata['label']) ? $this->translator->trans($metadata['label']) : null;
             $actionsMetadata[$action->getName()] = $metadata;
         }
     }
     $data->offsetAddToArray(static::METADATA_ACTION_KEY, $actionsMetadata);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:17,代码来源:ActionExtension.php

示例7: build

 /**
  * Create, configure and build datagrid
  *
  * @param DatagridConfiguration $config
  * @param ParameterBag          $parameters
  *
  * @return DatagridInterface
  */
 public function build(DatagridConfiguration $config, ParameterBag $parameters)
 {
     $event = new PreBuild($config, $parameters);
     $this->eventDispatcher->dispatch(PreBuild::NAME, $event);
     $class = $config->offsetGetByPath(self::BASE_DATAGRID_CLASS_PATH, $this->baseDatagridClass);
     $name = $config->getName();
     /** @var DatagridInterface $datagrid */
     $datagrid = new $class($name, $config, $parameters);
     $datagrid->setScope($config->offsetGetOr('scope'));
     $event = new BuildBefore($datagrid, $config);
     $this->eventDispatcher->dispatch(BuildBefore::NAME, $event);
     $acceptor = $this->createAcceptor($config, $parameters);
     $datagrid->setAcceptor($acceptor);
     $this->buildDataSource($datagrid, $config);
     $acceptor->processConfiguration();
     $event = new BuildAfter($datagrid);
     $this->eventDispatcher->dispatch(BuildAfter::NAME, $event);
     return $datagrid;
 }
开发者ID:xamin123,项目名称:platform,代码行数:27,代码来源:Builder.php

示例8: 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

示例9: visitMetadata

 /**
  * {@inheritdoc}
  */
 public function visitMetadata(DatagridConfiguration $config, MetadataObject $data)
 {
     $currentViewId = $this->getCurrentViewId($config->getName());
     $this->setDefaultParams($config->getName());
     $data->offsetAddToArray('initialState', ['gridView' => self::DEFAULT_VIEW_ID]);
     $data->offsetAddToArray('state', ['gridView' => $currentViewId]);
     $allLabel = null;
     if (isset($config['options'], $config['options']['gridViews'], $config['options']['gridViews']['allLabel'])) {
         $allLabel = $this->translator->trans($config['options']['gridViews']['allLabel']);
     }
     /** @var AbstractViewsList $list */
     $list = $config->offsetGetOr(self::VIEWS_LIST_KEY, false);
     $systemGridView = new View(self::DEFAULT_VIEW_ID);
     $systemGridView->setDefault($this->getDefaultViewId($config->getName()) === null);
     $gridViews = ['choices' => [['label' => $allLabel, 'value' => self::DEFAULT_VIEW_ID]], 'views' => [$systemGridView->getMetadata()]];
     if ($list !== false) {
         $configuredGridViews = $list->getMetadata();
         $configuredGridViews['views'] = array_merge($gridViews['views'], $configuredGridViews['views']);
         $configuredGridViews['choices'] = array_merge($gridViews['choices'], $configuredGridViews['choices']);
         $gridViews = $configuredGridViews;
     }
     if ($this->eventDispatcher->hasListeners(GridViewsLoadEvent::EVENT_NAME)) {
         $event = new GridViewsLoadEvent($config->getName(), $gridViews);
         $this->eventDispatcher->dispatch(GridViewsLoadEvent::EVENT_NAME, $event);
         $gridViews = $event->getGridViews();
     }
     $gridViews['gridName'] = $config->getName();
     $gridViews['permissions'] = $this->getPermissions();
     $data->offsetAddToArray('gridViews', $gridViews);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:33,代码来源:GridViewsExtension.php

示例10: 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

示例11: isApplicable

 /**
  * {@inheritDoc}
  */
 public function isApplicable(DatagridConfiguration $config)
 {
     $columns = $config->offsetGetOr(self::COLUMNS_PATH, []);
     $this->processConfigs($config);
     return count($columns) > 0;
 }
开发者ID:sagikazarmark,项目名称:platform,代码行数:9,代码来源:ColumnsExtension.php

示例12: processConfigs

 /**
  * {@inheritdoc}
  */
 public function processConfigs(DatagridConfiguration $config)
 {
     $actions = $config->offsetGetOr(static::MASS_ACTION_KEY, []);
     $actions['delete'] = $this->getMassDeleteActionConfig($config);
     $config->offsetSet(static::MASS_ACTION_KEY, $actions);
 }
开发者ID:startupz,项目名称:platform-1,代码行数:9,代码来源:DeleteMassActionExtension.php

示例13: visitMetadata

 /**
  * {@inheritDoc}
  */
 public function visitMetadata(DatagridConfiguration $config, MetadataObject $data)
 {
     $data->offsetSet(Configuration::BASE_CONFIG_KEY, $config->offsetGetOr(Configuration::BASE_CONFIG_KEY, []));
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:InlineEditingExtension.php

示例14: isApplicable

 /**
  * {@inheritDoc}
  */
 public function isApplicable(DatagridConfiguration $config)
 {
     $massActions = $config->offsetGetOr(static::ACTION_KEY, []);
     return !empty($massActions);
 }
开发者ID:Maksold,项目名称:platform,代码行数:8,代码来源:MassActionExtension.php

示例15: getMixins

 /**
  * @param DatagridConfiguration $config
  * @param ParameterBag          $parameters
  *
  * @return string[]
  */
 protected function getMixins(DatagridConfiguration $config, ParameterBag $parameters)
 {
     $mixins = (array) $config->offsetGetOr(self::MIXINS, []);
     $mixins = array_merge($mixins, (array) $parameters->get(self::GRID_MIXIN, []));
     return $mixins;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:12,代码来源:MixinListener.php


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