} $lockwarning = ''; if ($themelocked) { $lockwarning = html_writer::div(get_string('configoverride', 'admin'), 'alert alert-info'); } $table->data[] = array($OUTPUT->heading(ucfirst($thedevice), 3), $screenshotcell, $headingthemename . $lockwarning . $select . $unsetthemebutton); } } else { // Either a device has been selected of $CFG->enabledevicedetection is off so display a list // of themes to select. $heading = get_string('selecttheme', 'admin', $device); if (empty($device)) { // If $CFG->enabledevicedetection is off this will return 'default'. $device = core_useragent::get_device_type(); } $themelocked = theme_is_device_locked($device); $table->id = 'adminthemeselector'; $table->head = array(get_string('theme'), get_string('info')); $themes = array(); if ($themelocked) { $heading = get_string('currenttheme', 'admin'); $themename = theme_get_locked_theme_for_device($device); $themedirectory = core_component::get_plugin_directory('theme', $themename); $themes[$themename] = $themedirectory; } else { $themes = core_component::get_plugin_list('theme'); } foreach ($themes as $themename => $themedir) { // Load the theme config. try { $theme = theme_config::load($themename);
/** * 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]; }