setVal() 공개 메소드

set config value
public setVal ( string $key, mixed $value, boolean $toDesc = false, callable $filter = null, string $siteKey = 'default' ) : void
$key string the name of target including entity name
$value mixed the value to be set
$toDesc boolean descendants modify if true
$filter callable filter function
$siteKey string site key
리턴 void
예제 #1
0
 /**
  * setHomeInstanceId
  *
  * @param string      $instanceId menu item instance id
  * @param null|string $siteKey    site key
  *
  * @return string
  */
 public function setHomeInstanceId($instanceId, $siteKey = null)
 {
     if (is_null($siteKey)) {
         $siteKey = $this->currentSite->siteKey;
     }
     $this->config->setVal(sprintf("site.%s.homeInstance", $siteKey), $instanceId);
 }
 /**
  * 주어진 타겟에 지정된 스킨의 설정을 저장한다.
  *
  * @param string $key    target key
  * @param string $skinId skin id
  * @param array  $config skin config data
  *
  * @return void
  */
 public function setConfigs($key, $skinId, $config = null)
 {
     if ($config === null) {
         $config = $skinId;
         $skinId = null;
     }
     $key = $this->makeStoreKey(static::PREFIX_KEY_CONFIGS, $key);
     if ($skinId === null) {
         $this->store->set($key, $config);
     } else {
         $this->store->setVal("{$key}.{$skinId}", $config);
     }
 }
예제 #3
0
 public function testSetToDesc()
 {
     list($repo, $validator) = $this->getMocks();
     $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity');
     $mockConfig->name = 'board.notice';
     $mockConfig->shouldReceive('set')->with('listCount', 20)->andReturnNull();
     $mockConfig->shouldReceive('getPure')->with('listCount')->andReturn(20);
     $repo->shouldReceive('find')->once()->with('default', 'board.notice')->andReturn($mockConfig);
     $repo->shouldReceive('fetchParent')->with('default', 'board.notice')->andReturn([]);
     $repo->shouldReceive('save')->once()->with($mockConfig)->andReturn($mockConfig);
     $mockDesc1 = m::mock('Xpressengine\\Config\\ConfigEntity');
     $mockDesc1->shouldReceive('set')->with('listCount', 20)->andReturnNull();
     $mockDesc2 = m::mock('Xpressengine\\Config\\ConfigEntity');
     $mockDesc2->shouldReceive('set')->with('listCount', 20)->andReturnNull();
     $mockDesc3 = m::mock('Xpressengine\\Config\\ConfigEntity');
     $mockDesc3->shouldReceive('set')->with('listCount', 20)->andReturnNull();
     $repo->shouldReceive('fetchChildren')->with('default', 'board.notice')->andReturn([$mockDesc1, $mockDesc2, $mockDesc3]);
     $repo->shouldReceive('save')->once()->with($mockDesc1)->andReturnNull();
     $repo->shouldReceive('save')->once()->with($mockDesc2)->andReturnNull();
     $repo->shouldReceive('save')->once()->with($mockDesc3)->andReturnNull();
     $instance = new ConfigManager($repo, $validator);
     $instance->setVal('board.notice.listCount', 20, true);
 }
예제 #4
0
 /**
  * 플러그인 상태정보를 갱신한다.
  *
  * @param array $configs status list
  *
  * @return void
  */
 protected function setPluginsStatus(array $configs)
 {
     $this->config->setVal($this->configKey, $configs);
 }