add() public method

create new config
public add ( string $group, array $collection, string $siteKey = 'default' ) : ConfigEntity
$group string the name of target
$collection array entity value list
$siteKey string site key
return ConfigEntity
 /**
  * Process to Store
  *
  * @param string $instanceId
  * @param array  $menuTypeParams
  * @param array  $itemParams
  *
  * @return mixed
  * @internal param $inputs
  *
  */
 public function storeMenu($instanceId, $menuTypeParams, $itemParams)
 {
     $filePath = $menuTypeParams['includePath'];
     $this->checkFileSecurity($filePath);
     $configName = $this->getPageConfigKeyString($instanceId);
     $this->configManager->add($configName, $menuTypeParams);
 }
 /**
  * 사용할 아이템들을 설정에 저장
  *
  * @param string      $id         target plugin id
  * @param string|null $instanceId instance id
  * @param array       $keys       menu item keys
  * @return \Xpressengine\Config\ConfigEntity
  */
 public function setActivates($id, $instanceId = null, array $keys = [])
 {
     $configKey = $this->getConfigKey($id, $instanceId);
     $config = [];
     if (count($keys) > 0) {
         $config = ['activate' => $keys];
     }
     if (!$this->cfg->get($configKey)) {
         return $this->cfg->add($configKey, $config);
     }
     return $this->cfg->put($configKey, $config);
 }
Exemplo n.º 3
0
 public function testAddThrowsExceptionWhenExists()
 {
     list($repo, $validator) = $this->getMocks();
     $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity');
     $repo->shouldReceive('find')->once()->with('default', 'board.notice')->andReturn($mockConfig);
     $instance = new ConfigManager($repo, $validator);
     try {
         $config = $instance->add('board.notice', ['commentable' => false, 'downloadable' => true]);
         $this->assertTrue(false);
     } catch (\Exception $e) {
         $this->assertInstanceOf('Xpressengine\\Config\\Exceptions\\DuplicateException', $e);
     }
 }
Exemplo n.º 4
0
 /**
  * create document instance
  *
  * @param ConfigEntity $config document instance config
  * @return ConfigEntity
  */
 public function add(ConfigEntity $config)
 {
     $this->configManager->add(sprintf('%s.%s', self::CONFIG_NAME, $config->get('instanceId')), $config->getPureAll());
     return $config;
 }
Exemplo n.º 5
0
 /**
  * Set menu config consisting of theme identifiers
  *
  * @param MenuItem $item         menu item instance
  * @param string   $desktopTheme theme id
  * @param string   $mobileTheme  theme id
  * @return void
  */
 public function setMenuItemTheme(MenuItem $item, $desktopTheme, $mobileTheme)
 {
     $this->configs->add($this->menuKeyString($item), ['desktopTheme' => $desktopTheme, 'mobileTheme' => $mobileTheme]);
 }
Exemplo n.º 6
0
 /**
  * add config
  *
  * @param array $params parameters
  * @return ConfigEntity
  * @throws \Xpressengine\Config\Exceptions\InvalidArgumentException
  */
 public function add(array $params)
 {
     return $this->configManager->add($this->name($params['boardId']), $params);
 }
Exemplo n.º 7
0
 /**
  * parent config 설정
  *
  * @param string $group group name
  * @return void
  * @throws \Xpressengine\Config\Exceptions\InvalidArgumentException
  */
 public function setParent($group)
 {
     $this->configManager->add(sprintf('%s.%s', self::CONFIG_NAME, $group), []);
 }
Exemplo n.º 8
0
 /**
  * addPageConfig
  *
  * @param string $pageId      page instance id
  * @param array  $pageConfigs parameter array
  *
  * @return void
  * @throws \Xpressengine\Config\Exceptions\InvalidArgumentException
  */
 protected function addPageConfig($pageId, $pageConfigs)
 {
     $configName = $this->getConfigKeyString($pageId);
     $this->configManager->add($configName, $pageConfigs);
 }
 /**
  * setMenuItemTheme
  *
  * @param MenuItem $item         menuItem
  * @param string   $desktopTheme desktop theme value
  * @param string   $mobileTheme  mobile theme value
  *
  * @throws InvalidArgumentException
  * @return void
  */
 public function setMenuItemTheme(MenuItem $item, $desktopTheme, $mobileTheme)
 {
     $this->configManager->add($this->menuKeyString($item->getBreadCrumbsKeyString()), ['desktopTheme' => $desktopTheme, 'mobileTheme' => $mobileTheme]);
 }