MDL-75218 theme: Add a Favicon setting
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ function admin_page_type_list($pagetype, $parentcontext, $currentcontext) {
|
||||
function core_admin_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
|
||||
global $CFG;
|
||||
|
||||
if (in_array($filearea, ['logo', 'logocompact'])) {
|
||||
if (in_array($filearea, ['logo', 'logocompact', 'favicon'])) {
|
||||
$size = array_shift($args); // The path hides the size.
|
||||
$itemid = clean_param(array_shift($args), PARAM_INT);
|
||||
$filename = clean_param(array_shift($args), PARAM_FILE);
|
||||
|
||||
@@ -82,6 +82,14 @@ reports,core_reportbuilder|/reportbuilder/index.php',
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$temp->add($setting);
|
||||
|
||||
// Favicon file setting.
|
||||
$title = get_string('favicon', 'admin');
|
||||
$description = get_string('favicon_desc', 'admin');
|
||||
$setting = new admin_setting_configstoredfile('core_admin/favicon', $title, $description, 'favicon', 0,
|
||||
['maxfiles' => 1, 'accepted_types' => ['image']]);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$temp->add($setting);
|
||||
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// Course colours section.
|
||||
|
||||
@@ -615,6 +615,8 @@ $string['experimentalsettings'] = 'Experimental settings';
|
||||
$string['extendedusernamechars'] = 'Allow extended characters in usernames';
|
||||
$string['extramemorylimit'] = 'Extra PHP memory limit';
|
||||
$string['fatalsessionautostart'] = '<p>Serious configuration error detected, please notify server administrator.</p><p> To operate properly, Moodle requires that administrator changes PHP settings.</p><p><code>session.auto_start</code> must be set to <code>off</code>.</p><p>This setting is controlled by editing <code>php.ini</code>, Apache/IIS <br />configuration or <code>.htaccess</code> file on the server.</p>';
|
||||
$string['favicon'] = 'Favicon';
|
||||
$string['favicon_desc'] = 'Favicon file to be displayed as site icon';
|
||||
$string['feedbacksettings'] = 'Feedback settings';
|
||||
$string['filescleanupperiod'] = 'Clean up trash pool files';
|
||||
$string['filescleanupperiod_help'] = 'How often trash pool files are deleted. These are files that are associated with a context that no longer exists, for example when a course is deleted. Please note: This setting can result in missing files in a course which is backed up, deleted and then restored if the setting \'Include files\' (backup_auto_files) in \'Automated backup settings\' is disabled.';
|
||||
|
||||
@@ -4266,7 +4266,15 @@ EOD;
|
||||
* @return moodle_url The moodle_url for the favicon
|
||||
*/
|
||||
public function favicon() {
|
||||
return $this->image_url('favicon', 'theme');
|
||||
global $CFG;
|
||||
$logo = get_config('core_admin', 'favicon');
|
||||
if (empty($logo)) {
|
||||
return $this->image_url('favicon', 'theme');
|
||||
}
|
||||
|
||||
// Use $CFG->themerev to prevent browser caching when the file changes.
|
||||
return moodle_url::make_pluginfile_url(context_system::instance()->id, 'core_admin', 'favicon', '64x64/',
|
||||
theme_get_revision(), $logo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ information provided here is intended especially for theme designer.
|
||||
=== 4.1 ===
|
||||
* The function core_course_renderer::course_modchooser() has been finally deprecated and can not be used anymore.
|
||||
Please use core_course_renderer::course_activitychooser() instead.
|
||||
* $OUTPUT->favicon() now returns the URL of the configurable favicon if present.
|
||||
|
||||
=== 4.0 ===
|
||||
* A new theme config 'removedprimarynavitems' allows a theme to customise primary navigation by specifying the list of items to remove.
|
||||
|
||||
Reference in New Issue
Block a user