コード例 #1
0
 /**
  * _getOptionsArray
  *
  * Getter for `options`. Array's are json-decoded.
  *
  * @return array
  */
 protected function _getOptions()
 {
     if (array_key_exists('name', $this->_properties)) {
         $options = Setting::options($this->_properties['name']);
         if (is_callable($options)) {
             return $options();
         }
         return $options;
     }
     return false;
 }
コード例 #2
0
ファイル: SettingTest.php プロジェクト: jxav/cakephp-settings
 /**
  * Test options-method
  */
 public function testOptions()
 {
     Setting::register('App.Key', 1, ['options' => [0 => 'One', 1 => 'Two']]);
     $expected = [0 => 'One', 1 => 'Two'];
     $this->assertEquals($expected, Setting::options('App.Key'));
     Setting::options('App.Second', [0 => 'One', 1 => 'Two']);
 }