Exemplo n.º 1
0
 /**
  * Create a new setting object with some default properties
  *
  * @param string $name object name
  * @param string $value object value
  * @param array  $options array of options
  */
 public static function createNewSetting($name, $value, $options = array())
 {
     $setting = new QubitSetting();
     $setting->setName($name);
     $setting->setValue($value);
     if (isset($options['scope'])) {
         $setting->setScope($options['scope']);
     }
     // Default "editable" to true, unless forced to false
     $setting->setEditable(1);
     if (isset($options['editable']) && $options['editable'] == false) {
         $setting->setEditable(0);
     }
     // Default "deleteable" to true, unless forced to false
     $setting->setDeleteable(1);
     if (isset($options['deleteable']) && $options['deleteable'] == false) {
         $setting->setDeleteable(0);
     }
     // Set the source culture option
     if (isset($options['sourceCulture'])) {
         $setting->setSourceCulture($options['sourceCulture']);
     }
     // Set the culture option
     if (isset($options['culture'])) {
         $setting->setCulture($options['culture']);
     }
     return $setting;
 }