# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/backup/util/settings/backup_setting.class.php
--- moodle/backup/util/settings/backup_setting.class.php Base (1.4)
+++ moodle/backup/util/settings/backup_setting.class.php Locally Modified (Based On 1.4)
@@ -65,8 +65,6 @@
      * @param array $options
      */
     public function make_ui($type, $label, array $attributes = null, array $options = null) {
-        $type = $this->validate_ui_type($type);
-        $label = $this->validate_ui_label($label);
         $this->uisetting = backup_setting_ui::make($this, $type, $label, $attributes, $options);
         if (is_array($options) || is_object($options)) {
             $options = (array)$options;
Index: moodle/backup/util/settings/base_setting.class.php
--- moodle/backup/util/settings/base_setting.class.php Base (1.16)
+++ moodle/backup/util/settings/base_setting.class.php Locally Modified (Based On 1.16)
@@ -435,21 +435,6 @@
         return $status;
     }
 
-    protected function validate_ui_type($type) {
-        if ($type !== self::UI_HTML_CHECKBOX && $type !== self::UI_HTML_RADIOBUTTON &&
-            $type !== self::UI_HTML_DROPDOWN && $type !== self::UI_HTML_TEXTFIELD) {
-            throw new base_setting_exception('setting_invalid_ui_type');
-        }
-        return $type;
-    }
-
-    protected function validate_ui_label($label) {
-        if (empty($label) || $label !== clean_param($label, PARAM_TEXT)) {
-            throw new base_setting_exception('setting_invalid_ui_label');
-        }
-        return $label;
-    }
-
     protected function inform_dependencies($ctype, $oldv) {
         foreach ($this->dependencies as $dependency) {
             $dependency->process_change($ctype, $oldv);
Index: moodle/backup/util/ui/backup_ui_setting.class.php
--- moodle/backup/util/ui/backup_ui_setting.class.php Base (1.8)
+++ moodle/backup/util/ui/backup_ui_setting.class.php Locally Modified (Based On 1.8)
@@ -115,6 +115,9 @@
      * @param string $label
      */
     public function set_label($label) {
+        if (empty($label) || $label !== clean_param($label, PARAM_TEXT)) {
+            throw new base_setting_ui_exception('setting_invalid_ui_label');
+        }
         $this->label = $label;
     }
     /**
@@ -174,12 +177,15 @@
     /**
      * Creates a new backup setting ui based on the setting it is given
      *
+     * Throws an exception if an invalid type is provided.
+     *
      * @param backup_setting $setting
      * @param int $type The backup_setting UI type. One of backup_setting::UI_*;
      * @param string $label The label to display with the setting ui
      * @param array $attributes Array of HTML attributes to apply to the element
      * @param array $options Array of options to apply to the setting ui object
-     * @return backup_setting_ui_text
+     * 
+     * @return backup_setting_ui_text|backup_setting_ui_checkbox|backup_setting_ui_select|backup_setting_ui_radio
      */
     final public static function make(backup_setting $setting, $type, $label, array $attributes = null, array $options=null) {
         // Base the decision we make on the type that was sent
@@ -193,7 +199,7 @@
             case backup_setting::UI_HTML_TEXTFIELD :
                 return new backup_setting_ui_text($setting, $label, $attributes, $options);
             default:
-                return false;
+                throw new backup_setting_ui_exception('setting_invalid_ui_type');
         }
     }
     /**
@@ -521,3 +527,6 @@
         return parent::get_static_value();
     }
 }
+
+class base_setting_ui_exception extends base_setting_exception {}
+class backup_setting_ui_exception extends base_setting_ui_exception {};
\ No newline at end of file
