diff --git a/lib/classes/useragent.php b/lib/classes/useragent.php index dfea02a4409..0aa717d90fc 100644 --- a/lib/classes/useragent.php +++ b/lib/classes/useragent.php @@ -252,9 +252,15 @@ class core_useragent { * * This used to be get_selected_theme_for_device_type. * @param null|string $devicetype The device type to find out for. Defaults to the device the user is using, + * @deprecated since 4.3. * @return bool */ public static function get_device_type_theme($devicetype = null) { + debugging( + __FUNCTION__ . '() is deprecated.' . + 'All functions associated with device specific themes are being removed.', + DEBUG_DEVELOPER + ); global $CFG; if ($devicetype === null) { $devicetype = self::get_device_type(); @@ -272,9 +278,15 @@ class core_useragent { * Used to be get_device_cfg_var_name. * * @param null|string $devicetype The device type to find out for. Defaults to the device the user is using, + * @deprecated since 4.3. * @return string */ public static function get_device_type_cfg_var_name($devicetype = null) { + debugging( + __FUNCTION__ . '() is deprecated.' . + 'All functions associated with device specific themes are being removed.', + DEBUG_DEVELOPER + ); if ($devicetype == self::DEVICETYPE_DEFAULT || empty($devicetype)) { return 'theme'; } diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index ed03e6ee318..9f06fc0e103 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -3905,3 +3905,44 @@ function badges_get_oauth2_service_options() { return $options; } + +/** + * Checks if the given device has a theme defined in config.php. + * + * @param string $device The device + * @deprecated since 4.3. + * @return bool + */ +function theme_is_device_locked($device) { + debugging( + __FUNCTION__ . '() is deprecated.' . + 'All functions associated with device specific themes are being removed.', + DEBUG_DEVELOPER + ); + global $CFG; + $themeconfigname = core_useragent::get_device_type_cfg_var_name($device); + return isset($CFG->config_php_settings[$themeconfigname]); +} + +/** + * Returns the theme named defined in config.php for the given device. + * + * @param string $device The device + * @deprecated since 4.3. + * @return string or null + */ +function theme_get_locked_theme_for_device($device) { + debugging( + __FUNCTION__ . '() is deprecated.' . + 'All functions associated with device specific themes are being removed.', + DEBUG_DEVELOPER + ); + global $CFG; + + if (!theme_is_device_locked($device)) { + return null; + } + + $themeconfigname = core_useragent::get_device_type_cfg_var_name($device); + return $CFG->config_php_settings[$themeconfigname]; +} diff --git a/lib/outputlib.php b/lib/outputlib.php index dab6f7c7ed2..032176102cd 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -300,33 +300,6 @@ function theme_set_designer_mod($state) { theme_reset_all_caches(); } -/** - * Checks if the given device has a theme defined in config.php. - * - * @return bool - */ -function theme_is_device_locked($device) { - global $CFG; - $themeconfigname = core_useragent::get_device_type_cfg_var_name($device); - return isset($CFG->config_php_settings[$themeconfigname]); -} - -/** - * Returns the theme named defined in config.php for the given device. - * - * @return string or null - */ -function theme_get_locked_theme_for_device($device) { - global $CFG; - - if (!theme_is_device_locked($device)) { - return null; - } - - $themeconfigname = core_useragent::get_device_type_cfg_var_name($device); - return $CFG->config_php_settings[$themeconfigname]; -} - /** * This class represents the configuration variables of a Moodle theme. * diff --git a/lib/upgrade.txt b/lib/upgrade.txt index f7fff9f9738..9a84547db46 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -18,6 +18,11 @@ information provided here is intended especially for developers. whether the settings can be overriden or not will depend on the value of implemented \admin_setting::is_forceable() method, even if we define the settings in config.php. * New core_renderer::paragraph method to replace the overused html_writer::tag('p', ...) pattern. +* All functions associated with device specific themes have been deprecated. + - core_useragent::get_device_type_theme() + - core_useragent::get_device_type_cfg_var_name() + - theme_is_device_locked() + - theme_get_locked_theme_for_device() === 4.2 ===