Merge branch 'MDL-69109-38-2' of git://github.com/marinaglancy/moodle into MOODLE_38_STABLE
This commit is contained in:
@@ -72,22 +72,22 @@ abstract class icon_system {
|
||||
/**
|
||||
* Factory method
|
||||
*
|
||||
* @param $type Either a specific type, or null to get the default type.
|
||||
* @param string $type Either a specific type, or null to get the default type.
|
||||
* @return \core\output\icon_system
|
||||
*/
|
||||
public final static function instance($type = null) {
|
||||
global $PAGE;
|
||||
|
||||
if ($type == null) {
|
||||
if (!empty(self::$instance)) {
|
||||
return self::$instance;
|
||||
}
|
||||
$type = $PAGE->theme->get_icon_system();
|
||||
self::$instance = new $type();
|
||||
// Default one is a singleton.
|
||||
if (empty(self::$instance)) {
|
||||
$icontype = $PAGE->theme->get_icon_system();
|
||||
self::$instance = new $icontype();
|
||||
}
|
||||
|
||||
// If $type is specified we need to make sure that the theme icon system supports this type,
|
||||
// if not, we will return a generic new instance of the $type.
|
||||
if ($type === null || is_a(self::$instance, $type)) {
|
||||
return self::$instance;
|
||||
} else {
|
||||
// Not a singleton.
|
||||
return new $type();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,7 +434,10 @@ class icon_system_fontawesome extends icon_system_font {
|
||||
if ($this->map === []) {
|
||||
$cache = \cache::make('core', 'fontawesomeiconmapping');
|
||||
|
||||
$this->map = $cache->get('mapping');
|
||||
// Create different mapping keys for different icon system classes, there may be several different
|
||||
// themes on the same site.
|
||||
$mapkey = 'mapping_'.preg_replace('/[^a-zA-Z0-9_]/', '_', get_class($this));
|
||||
$this->map = $cache->get($mapkey);
|
||||
|
||||
if (empty($this->map)) {
|
||||
$this->map = $this->get_core_icon_map();
|
||||
@@ -448,7 +451,7 @@ class icon_system_fontawesome extends icon_system_font {
|
||||
}
|
||||
}
|
||||
}
|
||||
$cache->set('mapping', $this->map);
|
||||
$cache->set($mapkey, $this->map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user