private static function get_setting_default($config, $setting) {
        $value = get_config('restore', $config);

        if (in_array($setting->get_name(), ['course_fullname', 'course_shortname', 'course_startdate']) &&
                $setting->get_ui() instanceof backup_setting_ui_defaultcustom) {
            // Special case - admin config settings course_fullname, etc. are boolean and the restore settings are strings.
            $value = (bool)$value;
            if ($value) {
                $attributes = $setting->get_ui()->get_attributes();
                $value = $attributes['customvalue'];
            }
        }

        if ($setting->get_ui() instanceof backup_setting_ui_select) {
            // Make sure the value is a valid option in the select element, otherwise just pick the first from the options list.
            // Example: enrolments dropdown may not have the "enrol_withusers" option because users info can not be restored.
            $options = array_keys($setting->get_ui()->get_values());
            if (!in_array($value, $options)) {
                $value = reset($options);
            }
        }

        return $value;
    }
private static function get_setting_default($config, $setting) {
        $value = get_config('restore', $config);

        if (in_array($setting->get_name(), ['course_fullname', 'course_shortname', 'course_startdate']) &&
                $setting->get_ui() instanceof backup_setting_ui_defaultcustom) {
            // Special case - admin config settings course_fullname, etc. are boolean and the restore settings are strings.
            $value = (bool)$value;
            if ($value) {
                $attributes = $setting->get_ui()->get_attributes();
                $value = $attributes['customvalue'];
            }
        }

        if ($setting->get_ui() instanceof backup_setting_ui_select) {
            // Make sure the value is a valid option in the select element, otherwise just pick the first from the options list.
            // Example: enrolments dropdown may not have the "enrol_withusers" option because users info can not be restored.
            $options = array_keys($setting->get_ui()->get_values());
            if (!in_array($value, $options)) {
                $value = reset($options);
            }
        }

        return $value;
    }
private static function get_setting_default ( $ config , $ setting ) { $ value = get_config ( 'restore' , $ config ) ; if ( in_array ( $ setting -> get_name ( ) , [ 'course_fullname' , 'course_shortname' , 'course_startdate' ] ) && $ setting -> get_ui ( ) instanceof backup_setting_ui_defaultcustom ) { // Special case - admin config settings course_fullname, etc. are boolean and the restore settings are strings. $ value = ( bool ) $ value ; if ( $ value ) { $ attributes = $ setting -> get_ui ( ) -> get_attributes ( ) ; $ value = $ attributes [ 'customvalue' ] ; } } if ( $ setting -> get_ui ( ) instanceof backup_setting_ui_select ) { // Make sure the value is a valid option in the select element, otherwise just pick the first from the options list. // Example: enrolments dropdown may not have the "enrol_withusers" option because users info can not be restored. $ options = array_keys ( $ setting -> get_ui ( ) -> get_values ( ) ) ; if ( ! in_array ( $ value , $ options ) ) { $ value = reset ( $ options ) ; } } return $ value ; }
Returns the default value to be used for a setting from the admin restore config

@param string $config
@param backup_setting $setting
@return mixed
Returns the default value to be used for a setting from the admin restore config