get() public method

returns config object by target name
public get ( string $group, boolean $create = false, string $siteKey = 'default' ) : ConfigEntity
$group string the name of target
$create boolean if not exists, create new entity object
$siteKey string site key
return ConfigEntity
 /**
  * get config Entity
  * $instanceId 가 없을 경우 default config 반환
  *
  * @param string $instanceId instance id
  * @return ConfigEntity
  */
 public function get($instanceId = null)
 {
     if ($instanceId === null) {
         return $this->configManager->get(self::CONFIG_NAME);
     } else {
         return $this->configManager->get(sprintf('%s.%s', self::CONFIG_NAME, $instanceId));
     }
 }
Esempio n. 2
0
 /**
  * getSiteConfig
  *
  * @param string|null $siteKey site key
  *
  * @return ConfigEntity
  */
 public function getSiteConfig($siteKey = null)
 {
     if (is_null($siteKey)) {
         $siteKey = $this->currentSite->siteKey;
     }
     return $this->config->get(sprintf("site.%s", $siteKey));
 }
 /**
  * Get editor id by instance id
  *
  * @param string $instanceId instance id
  * @return string
  */
 public function getEditorId($instanceId)
 {
     if (!($config = $this->configManager->get(self::MAP_CONFIG_NAME))) {
         $config = $this->configManager->set(self::MAP_CONFIG_NAME, []);
     }
     return $config->get($instanceId);
 }
 /**
  * 주어진 타겟과 그 타겟에 지정된 스킨의 설정정보를 가져온다. 주어진 타겟에 한번이라도 지정된 적이 있는 스킨정보를 모두 가져온다.
  * 두번째 파라메터가 있을 경우, 주어진 스킨의 설정정보만 가져온다.
  *
  * @param string $key    target key
  * @param string $skinId skin id
  *
  * @return mixed
  */
 public function getConfigs($key, $skinId = null)
 {
     $key = $this->makeStoreKey(static::PREFIX_KEY_CONFIGS, $key);
     if ($skinId === null) {
         $config = $this->store->get($key);
         return $config->getPureAll();
     } else {
         $config = $this->store->getPureVal("{$key}.{$skinId}", []);
         return $config;
     }
 }
Esempio n. 5
0
 /**
  * Check a setting information exists
  *
  * @return bool
  */
 public function exists()
 {
     if ($this->config !== null) {
         return true;
     }
     if (!($config = $this->cfg->get($this->key))) {
         return false;
     }
     $this->config = $config;
     return true;
 }
 /**
  * 사용할 아이템들을 설정에 저장
  *
  * @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);
 }
Esempio n. 7
0
 /**
  * 활성화된 아이템 목록을 반환
  *
  * @param string      $id         target plugin id
  * @param string|null $instanceId instance id
  * @return array
  */
 public function getActivated($id, $instanceId = null)
 {
     if (($config = $this->cfg->get($this->getConfigKey($id, $instanceId))) === null) {
         $config = $this->setActivates($id, $instanceId);
     }
     $keys = $config->get('activate', []);
     $activated = array_intersect_key($this->all($id), array_flip($keys));
     // sort
     $activated = array_merge(array_flip($keys), $activated);
     return array_filter($activated, function ($val) {
         return !empty($val);
     });
 }
 /**
  * 관리페이지 관련 설정을 조회한다.
  *
  * @param string $config 설정 키
  *
  * @return ConfigEntity
  */
 public function getConfig($config)
 {
     return $this->configManager->get(static::SETTING_CONFIG_NAME . '.' . $config);
 }
Esempio n. 9
0
 /**
  * Move menu item config consisting of theme identifiers
  *
  * @param MenuItem $beforeItem before item
  * @param MenuItem $movedItem  after item
  * @return void
  */
 public function moveItemConfig(MenuItem $beforeItem, MenuItem $movedItem)
 {
     $configEntity = $this->configs->get($this->menuKeyString($beforeItem));
     $to = $this->menuKeyString($movedItem);
     $this->configs->move($configEntity, substr($to, 0, strrpos($to, '.')));
 }
Esempio n. 10
0
 /**
  * get board config
  *
  * @param string $boardId board id
  * @return ConfigEntity
  */
 public function get($boardId)
 {
     $config = $this->configManager->get($this->name($boardId));
     return $config;
 }
 /**
  * moveItemConfig
  *
  * @param MenuItem $beforeItem to change theme value for before item moving
  * @param MenuItem $movedItem  to change theme value for after item moving
  *
  * @return void
  * @throws InvalidArgumentException
  */
 public function moveItemConfig(MenuItem $beforeItem, MenuItem $movedItem)
 {
     $configEntity = $this->configManager->get($this->menuKeyString($beforeItem->getBreadCrumbsKeyString()));
     $this->configManager->move($configEntity, $this->menuKeyString($movedItem->getBreadCrumbsKeyString(true)));
 }
Esempio n. 12
0
 /**
  * group 의 parent config 반환
  * config entity 반환
  *
  * @param string $group group name
  * @return ConfigEntity|null
  */
 public function parent($group)
 {
     return $this->configManager->get(sprintf('%s.%s', self::CONFIG_NAME, $group));
 }
 /**
  * Put a comment
  *
  * @param CommentEntity $comment comment instance
  * @return CommentEntity
  */
 public function put(CommentEntity $comment)
 {
     $config = $this->configs->get($this->getConfigKey($comment->instanceId));
     if ($config->get('useWysiwyg') === true) {
         $comment->html = 1;
     }
     $updated = $this->repo->update($comment);
     return $this->member->associate($updated);
 }
Esempio n. 14
0
 /**
  * existPageInstance
  *
  * @param string $pageId page instance id
  *
  * @return bool
  */
 protected function existPageInstance($pageId)
 {
     $configName = $this->getConfigKeyString($pageId);
     return $this->configManager->get($configName) !== null;
 }
 /**
  * instance 별 설정 정보를 반환
  *
  * @param string $instanceId instance identifier
  * @return \Xpressengine\Config\ConfigEntity
  */
 protected function getConfig($instanceId)
 {
     return $this->configs->get($this->prefix . '.' . $instanceId);
 }
 /**
  * Return Edit Form View
  *
  * @param $instanceId
  *
  * @return mixed
  */
 public function editMenuForm($instanceId)
 {
     $config = $this->configManager->get($this->getPageConfigKeyString($instanceId));
     $form = View::file(__DIR__ . '/../../views/menuType/menuEdit.blade.php', ['instanceId' => $instanceId, 'config' => $config])->render();
     return $form;
 }
Esempio n. 17
0
 public function testGetsRetunsEntityObject()
 {
     list($repo, $validator) = $this->getMocks();
     $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity');
     $mockConfig->name = 'board.notice';
     $ancestor = m::mock('Xpressengine\\Config\\ConfigEntity');
     $ancestor->name = 'board';
     $mockConfig->shouldReceive('setParent')->once()->with($ancestor)->andReturnNull();
     $repo->shouldReceive('find')->once()->with('default', 'board.notice')->andReturn($mockConfig);
     $repo->shouldReceive('fetchParent')->with('default', 'board.notice')->andReturn([$ancestor]);
     $instance = new ConfigManager($repo, $validator);
     $config = $instance->get('board.notice');
     $this->assertInstanceOf('Xpressengine\\Config\\ConfigEntity', $config);
 }
Esempio n. 18
0
 /**
  * set config
  *
  * @param string $counterName counter name
  * @param string $type        counter type
  * @return void
  */
 public function set($counterName, $type = Counter::TYPE_ID)
 {
     $config = $this->configManager->get($this->name);
     $config->set($counterName, $type);
     $this->configManager->put($this->name, $config->getPureAll());
 }