Beispiel #1
0
 /**
  * Save the submitted data for this flag - or set it to the default if $data is null.
  *
  * @param admin_setting $setting - The admin setting for this flag
  * @param array $data - The data submitted from the form or null to set the default value for new installs.
  * @return bool
  */
 public function write_setting_flag(admin_setting $setting, $data)
 {
     $result = true;
     if ($this->is_enabled()) {
         if (!isset($data)) {
             $value = $this->get_default();
         } else {
             $value = !empty($data[$setting->get_full_name() . '_' . $this->get_shortname()]);
         }
         $result = $setting->config_write($setting->name . '_' . $this->get_shortname(), $value);
     }
     return $result;
 }