MDL-40759 icons: Refactor icon system to be extensible.
authorDamyon Wiese <damyon@moodle.com>
Tue, 3 Jan 2017 02:40:42 +0000 (10:40 +0800)
committerDamyon Wiese <damyon@moodle.com>
Fri, 17 Mar 2017 07:51:29 +0000 (15:51 +0800)
32 files changed:
lib/amd/build/icon_system.min.js [new file with mode: 0644]
lib/amd/build/icon_system_fontawesome.min.js [new file with mode: 0644]
lib/amd/build/icon_system_standard.min.js [new file with mode: 0644]
lib/amd/build/templates.min.js
lib/amd/src/icon_system.js [new file with mode: 0644]
lib/amd/src/icon_system_fontawesome.js [new file with mode: 0644]
lib/amd/src/icon_system_standard.js [new file with mode: 0644]
lib/amd/src/templates.js
lib/classes/output/external.php
lib/classes/output/icon_system.php [new file with mode: 0644]
lib/classes/output/icon_system_font.php [new file with mode: 0644]
lib/classes/output/icon_system_fontawesome.php [new file with mode: 0644]
lib/classes/output/icon_system_standard.php [new file with mode: 0644]
lib/db/services.php
lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js
lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js
lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js
lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js
lib/externallib.php
lib/outputcomponents.php
lib/outputlib.php
lib/outputrenderers.php
lib/outputrequirementslib.php
lib/templates/pix_icon.mustache
lib/templates/pix_icon_fontawesome.mustache [new file with mode: 0644]
lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js
lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js
lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop.js
lib/yui/src/dragdrop/js/dragdrop.js
theme/boost/classes/output/core_renderer.php
theme/boost/config.php
theme/font.php

diff --git a/lib/amd/build/icon_system.min.js b/lib/amd/build/icon_system.min.js
new file mode 100644 (file)
index 0000000..c3aa058
Binary files /dev/null and b/lib/amd/build/icon_system.min.js differ
diff --git a/lib/amd/build/icon_system_fontawesome.min.js b/lib/amd/build/icon_system_fontawesome.min.js
new file mode 100644 (file)
index 0000000..486881a
Binary files /dev/null and b/lib/amd/build/icon_system_fontawesome.min.js differ
diff --git a/lib/amd/build/icon_system_standard.min.js b/lib/amd/build/icon_system_standard.min.js
new file mode 100644 (file)
index 0000000..c31281b
Binary files /dev/null and b/lib/amd/build/icon_system_standard.min.js differ
index d1cb6ee..0e236ed 100644 (file)
Binary files a/lib/amd/build/templates.min.js and b/lib/amd/build/templates.min.js differ
diff --git a/lib/amd/src/icon_system.js b/lib/amd/src/icon_system.js
new file mode 100644 (file)
index 0000000..963e8a4
--- /dev/null
@@ -0,0 +1,59 @@
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Icon System base module.
+ *
+ * @package    core
+ * @copyright  2017 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define(['jquery'], function($) {
+
+    /**
+     * Icon System abstract class.
+     *
+     * Any icon system needs to define a module extending this one with the name core/icon_system_blah.
+     */
+    var IconSystem = function() {
+    };
+
+    /**
+     * Initialise the icon system.
+     *
+     * @return {Promise}
+     * @method init
+     */
+    IconSystem.prototype.init = function() {
+        return $.when();
+    };
+
+    /**
+     * Render an icon.
+     *
+     * @param {String} key
+     * @param {String} component
+     * @param {String} title
+     * @param {String} template
+     * @return {String}
+     * @method renderIcon
+     */
+    IconSystem.prototype.renderIcon = function(key, component, title, template) { //eslint-disable-line no-unused-vars
+        throw new Error('Abstract function not implemented.');
+    };
+
+    return /** @alias module:core/icon_system */ IconSystem;
+});
diff --git a/lib/amd/src/icon_system_fontawesome.js b/lib/amd/src/icon_system_fontawesome.js
new file mode 100644 (file)
index 0000000..46081a1
--- /dev/null
@@ -0,0 +1,92 @@
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Competency rule points module.
+ *
+ * @package    core
+ * @copyright  2017 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define(['core/icon_system', 'jquery', 'core/ajax', 'core/mustache', 'core/localstorage'],
+        function(IconSystem, $, Ajax, Mustache, LocalStorage) {
+
+    var staticMap = null;
+    var fetchMap = null;
+
+    /**
+     * IconSystemFontawesome
+     */
+    var IconSystemFontawesome = function() {
+        IconSystem.apply(this, arguments);
+    };
+    IconSystemFontawesome.prototype = Object.create(IconSystem.prototype);
+
+    IconSystemFontawesome.prototype.init = function() {
+        if (staticMap) {
+            return $.when();
+        }
+
+        var map = LocalStorage.get('core/iconmap-fontawesome');
+
+        if (map) {
+            staticMap = map;
+            return $.when();
+        }
+
+        if (fetchMap === null) {
+            fetchMap = Ajax.call([{
+                methodname: 'core_output_load_icon_map',
+                args: { 'system': 'fontawesome' }
+            }], true, false)[0];
+        }
+
+        return fetchMap.then(function(map) {
+            staticMap = {};
+            $.each(map, function(index, value) {
+                staticMap[value.component + '/' + value.pix] = value.to;
+            }.bind(this));
+            LocalStorage.set('core/iconmap-fontawesome', staticMap);
+        }.bind(this));
+    };
+
+    /**
+     * Render an icon.
+     *
+     * @param {String} key
+     * @param {String} component
+     * @param {String} title
+     * @param {String} template
+     * @return {String}
+     * @method renderIcon
+     */
+    IconSystemFontawesome.prototype.renderIcon = function(key, component, title, template) { //eslint-disable-line no-unused-vars
+        var mappedIcon = staticMap[component + '/' + key];
+        if (typeof mappedIcon === "undefined") {
+            mappedIcon = component + '/' + key;
+        }
+
+        var context = {
+            key: mappedIcon,
+            title: title
+        };
+
+        return Mustache.render(template, context);
+    };
+
+    return /** @alias module:core/icon_system_fontawesome */ IconSystemFontawesome;
+
+});
diff --git a/lib/amd/src/icon_system_standard.js b/lib/amd/src/icon_system_standard.js
new file mode 100644 (file)
index 0000000..579f87d
--- /dev/null
@@ -0,0 +1,61 @@
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Competency rule points module.
+ *
+ * @package    core
+ * @copyright  2017 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define(['core/icon_system', 'core/url', 'core/mustache'],
+        function(IconSystem, CoreUrl, Mustache) {
+
+    /**
+     * IconSystemStandard
+     */
+    var IconSystemStandard = function() {
+        IconSystem.apply(this, arguments);
+    };
+    IconSystemStandard.prototype = Object.create(IconSystem.prototype);
+
+    /**
+     * Render an icon.
+     *
+     * @param {String} key
+     * @param {String} component
+     * @param {String} title
+     * @param {String} template
+     * @return {String}
+     * @method renderIcon
+     */
+    IconSystemStandard.prototype.renderIcon = function(key, component, title, template) { //eslint-disable-line no-unused-vars
+        var url = CoreUrl.imageUrl(key, component);
+
+        var templatecontext = {
+            attributes: [
+                {name: 'src', value: url},
+                {name: 'alt', value: title},
+                {name: 'title', value: title}
+            ]
+        };
+        var result = Mustache.render(template, templatecontext);
+        return result.trim();
+    };
+
+    return /** @alias module:core/icon_system_standard */ IconSystemStandard;
+
+});
index dcb5fb4..7e658dc 100644 (file)
@@ -31,13 +31,14 @@ define(['core/mustache',
          'core/url',
          'core/config',
          'core/localstorage',
+         'core/icon_system',
          'core/event',
          'core/yui',
          'core/log',
          'core/truncate',
          'core/user_date'
        ],
-       function(mustache, $, ajax, str, notification, coreurl, config, storage, event, Y, Log, Truncate, UserDate) {
+       function(mustache, $, ajax, str, notification, coreurl, config, storage, IconSystem, event, Y, Log, Truncate, UserDate) {
 
     // Module variables.
     /** @var {Number} uniqInstances Count of times this constructor has been called. */
@@ -49,6 +50,9 @@ define(['core/mustache',
     /** @var {Promise[]} templatePromises - Cache of already loaded template promises */
     var templatePromises = {};
 
+    /** @var {Object} iconSystem - Object extending core/iconsystem */
+    var iconSystem = {};
+
     /**
      * Constructor
      *
@@ -144,6 +148,43 @@ define(['core/mustache',
         return templateCache[searchKey];
     };
 
+    /**
+     * Render a single image icon.
+     *
+     * @method renderIcon
+     * @private
+     * @param {string} key The icon key.
+     * @param {string} component The component name.
+     * @param {string} title The icon title
+     * @return {Promise}
+     */
+    Renderer.prototype.renderIcon = function(key, component, title) {
+        // Preload the module to do the icon rendering based on the theme iconsystem.
+        var modulename = 'core/icon_system_' + config.iconsystem;
+
+        var ready = $.Deferred();
+        require([modulename], function(System) {
+            var system = new System();
+            if (!(system instanceof IconSystem)) {
+                ready.reject('Invalid icon system specified' + config.iconsystem);
+            } else {
+                system.init().then(ready.resolve);
+                iconSystem = system;
+            }
+        });
+
+        var suffix = '';
+        if (config.iconsystem != 'standard') {
+            suffix = '_' + config.iconsystem;
+        }
+
+        return ready.then(function() {
+            return this.getTemplate('core/pix_icon' + suffix);
+        }.bind(this)).then(function(template) {
+            return iconSystem.renderIcon(key, component, title, template);
+        });
+    };
+
     /**
      * Render image icons.
      *
@@ -159,32 +200,27 @@ define(['core/mustache',
         var key = '';
         var component = '';
         var text = '';
-        var result;
 
         if (parts.length > 0) {
-            key = parts.shift().trim();
+            key = helper(parts.shift().trim());
         }
         if (parts.length > 0) {
-            component = parts.shift().trim();
+            component = helper(parts.shift().trim());
         }
         if (parts.length > 0) {
-            text = parts.join(',').trim();
+            text = helper(parts.join(',').trim());
         }
-        var url = coreurl.imageUrl(key, component);
-
-        var templatecontext = {
-            attributes: [
-                {name: 'src', value: url},
-                {name: 'alt', value: helper(text)},
-                {name: 'title', value: helper(text)},
-                {name: 'class', value: 'smallicon'}
-            ]
-        };
-        // We forced loading of this early, so it will be in the cache.
-        var searchKey = this.currentThemeName + '/core/pix_icon';
+
+        var suffix = '';
+        if (config.iconsystem != 'standard') {
+            suffix = '_' + config.iconsystem;
+        }
+
+
+        var searchKey = this.currentThemeName + '/core/pix_icon' + suffix;
         var template = templateCache[searchKey];
-        result = mustache.render(template, templatecontext, this.partialHelper.bind(this));
-        return result.trim();
+
+        return iconSystem.renderIcon(key, component, text, template);
     };
 
     /**
@@ -472,8 +508,12 @@ define(['core/mustache',
      */
     Renderer.prototype.doRender = function(templateSource, context, themeName) {
         this.currentThemeName = themeName;
+        var suffix = '';
+        if (config.iconsystem != 'standard') {
+            suffix = '_' + config.iconsystem;
+        }
 
-        return this.getTemplate('core/pix_icon').then(function() {
+        return this.getTemplate('core/pix_icon' + suffix).then(function() {
             this.addHelpers(context, themeName);
             var result = mustache.render(templateSource, context, this.partialHelper.bind(this));
             return $.Deferred().resolve(result.trim(), this.getJS()).promise();
@@ -654,9 +694,25 @@ define(['core/mustache',
 
         this.currentThemeName = themeName;
 
-        return this.cachePartials(templateName).then(function(templateSource) {
-            return this.doRender(templateSource, context, themeName);
-        }.bind(this));
+        // Preload the module to do the icon rendering based on the theme iconsystem.
+        var modulename = 'core/icon_system_' + config.iconsystem;
+
+        var ready = $.Deferred();
+        require([modulename], function(System) {
+            var system = new System();
+            if (!(system instanceof IconSystem)) {
+                ready.reject('Invalid icon system specified' + config.iconsystem);
+            } else {
+                iconSystem = system;
+                system.init().then(ready.resolve);
+            }
+        });
+
+        return ready.then(function() {
+                return this.cachePartials(templateName);
+            }.bind(this)).then(function(templateSource) {
+                return this.doRender(templateSource, context, themeName);
+            }.bind(this));
     };
 
     /**
@@ -721,6 +777,22 @@ define(['core/mustache',
             return renderer.render(templateName, context, themeName);
         },
 
+        /**
+         * Every call to renderIcon creates a new instance of the class and calls renderIcon on it. This
+         * means each render call has it's own class variables.
+         *
+         * @method renderIcon
+         * @public
+         * @param {string} key - Icon key.
+         * @param {string} component - Icon component
+         * @param {string} title - Icon title
+         * @return {Promise} JQuery promise object resolved when the pix has been rendered.
+         */
+        renderPix: function(key, component, title) {
+            var renderer = new Renderer();
+            return renderer.renderIcon(key, component, title);
+        },
+
         /**
          * Execute a block of JS returned from a template.
          * Call this AFTER adding the template HTML into the DOM so the nodes can be found.
index fb2537a..a57d096 100644 (file)
@@ -96,25 +96,35 @@ class external extends external_api {
     }
 
     /**
-     * Returns description of load_fontawesome_iconmap() parameters.
+     * Returns description of load_icon_map() parameters.
      *
      * @return external_function_parameters
      */
-    public static function load_fontawesome_iconmap_parameters() {
-        return new external_function_parameters([]);
+    public static function load_icon_map_parameters() {
+        return new external_function_parameters([
+                'system' => new external_value(PARAM_COMPONENT, 'icon system to load the map for')
+        ]);
     }
 
     /**
      * Return a mapping of icon names to icons.
      *
+     * @param string $system
      * @return array the mapping
      */
-    public static function load_fontawesome_iconmap() {
+    public static function load_icon_map($system) {
+        $params = self::validate_parameters(self::load_icon_map_parameters(),
+                                            array('system' => $system));
+
+        $system = $params['system'];
+
+        if (!icon_system::is_valid_system($system)) {
+            throw new coding_exception('Invalid icon system.');
+        }
         
-        $context = context_system::instance();
-        self::validate_context($context);
+        $instance = icon_system::instance($system);
 
-        $map = theme_get_fontawesome_icon_map();
+        $map = $instance->get_icon_name_map();
 
         $result = [];
 
@@ -130,11 +140,11 @@ class external extends external_api {
     }
 
     /**
-     * Returns description of load_template() result value.
+     * Returns description of load_icon_map() result value.
      *
      * @return external_description
      */
-    public static function load_fontawesome_iconmap_returns() {
+    public static function load_icon_map_returns() {
         return new external_multiple_structure(new external_single_structure(
             array(
                 'component' => new external_value(PARAM_COMPONENT, 'The component for the icon.'),
diff --git a/lib/classes/output/icon_system.php b/lib/classes/output/icon_system.php
new file mode 100644 (file)
index 0000000..9615e9d
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Contains class \core\output\icon_system
+ *
+ * @package    core
+ * @category   output
+ * @copyright  2016 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\output;
+
+use renderer_base;
+use pix_icon;
+
+/**
+ * Class allowing different systems for mapping and rendering icons.
+ *
+ * Possible icon styles are:
+ *   1. standard - image tags are generated which point to pix icons stored in a plugin pix folder.
+ *   2. fontawesome - font awesome markup is generated with the name of the icon mapped from the moodle icon name.
+ *   3. inline - inline tags are used for svg and png so no separate page requests are made (at the expense of page size).
+ *
+ * @package    core
+ * @category   output
+ * @copyright  2016 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+abstract class icon_system {
+    const STANDARD = 'standard';
+    const FONTAWESOME = 'fontawesome';
+    const INLINE = 'inline';
+    const SYSTEMS = [ self::STANDARD, self::FONTAWESOME, self::INLINE ];
+
+    private static $instance = null;
+    private $map = null;
+    protected $system = '';
+
+    private function __construct($system) {
+        $this->system = $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();
+            $system = '\\core\\output\\icon_system_' . $type;
+            self::$instance = new $system($type);
+            // Default one is a singleton.
+            return self::$instance;
+        } else {
+            $system = '\\core\\output\\icon_system_' . $type;
+            // Not a singleton.
+            return new $system($type);
+        }
+    }
+
+    /**
+     * Validate the theme config setting.
+     *
+     * @param string $system
+     * @return boolean
+     */
+    public final static function is_valid_system($system) {
+        return in_array($system, self::SYSTEMS);
+    }
+
+    /**
+     * Render the pix icon according to the icon system.
+     *
+     * @param renderer_base $output
+     * @param pix_icon $icon
+     * @return string
+     */
+    public abstract function render_pix_icon(renderer_base $output, pix_icon $icon);
+
+    /**
+     * Overridable function to get a mapping of all icons.
+     * Default is to do no mapping.
+     */
+    public function get_icon_name_map() {
+        return [];
+    }
+
+    /**
+     * Overridable function to map the icon name to something else.
+     * Default is to do no mapping. Map is cached in the singleton.
+     */
+    public final function remap_icon_name($iconname, $component) {
+        if ($this->map === null) {
+            $this->map = $this->get_icon_name_map();
+        }
+        if ($component == null) {
+            $component = 'core';
+        } else if ($component != 'theme') {
+            $component = \core_component::normalize_componentname($component);
+        }
+
+        if (isset($this->map[$component . ':' . $iconname])) {
+            return $this->map[$component . ':' . $iconname];
+        }
+        return false;
+    }
+}
+
diff --git a/lib/classes/output/icon_system_font.php b/lib/classes/output/icon_system_font.php
new file mode 100644 (file)
index 0000000..6900df4
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Contains class \core\output\icon_system
+ *
+ * @package    core
+ * @category   output
+ * @copyright  2016 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\output;
+
+use renderer_base;
+use pix_icon;
+
+/**
+ * Class allowing different systems for mapping and rendering icons.
+ *
+ * Possible icon styles are:
+ *   1. standard - image tags are generated which point to pix icons stored in a plugin pix folder.
+ *   2. fontawesome - font awesome markup is generated with the name of the icon mapped from the moodle icon name.
+ *   3. inline - inline tags are used for svg and png so no separate page requests are made (at the expense of page size).
+ *
+ * @package    core
+ * @category   output
+ * @copyright  2016 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+abstract class icon_system_font extends icon_system {
+
+    private $map = [];
+
+    public function get_core_icon_map() {
+        return [];
+    }
+
+    public function render_pix_icon(renderer_base $output, pix_icon $icon) {
+        $subtype = 'pix_icon_' . $this->system;
+        $subpix = new $subtype($icon);
+        $data = $subpix->export_for_template($output);
+
+        return $output->render_from_template('core/pix_icon_' . $this->system, $data);
+    }
+
+    /**
+     * Overridable function to get a mapping of all icons.
+     * Default is to do no mapping.
+     */
+    public function get_icon_name_map() {
+        if ($this->map === []) {
+            $this->map = $this->get_core_icon_map();
+            $callback = 'get_' . $this->system . '_icon_map';
+
+            if ($pluginsfunction = get_plugins_with_function($callback)) {
+                foreach ($pluginsfunction as $plugintype => $plugins) {
+                    foreach ($plugins as $pluginfunction) {
+                        $pluginmap = $pluginfunction();
+                        $this->map += $pluginmap;
+                    }
+                }
+            }
+
+        }
+        return $this->map;
+    }
+
+}
+
diff --git a/lib/classes/output/icon_system_fontawesome.php b/lib/classes/output/icon_system_fontawesome.php
new file mode 100644 (file)
index 0000000..d2e8e38
--- /dev/null
@@ -0,0 +1,796 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Contains class \core\output\icon_system
+ *
+ * @package    core
+ * @category   output
+ * @copyright  2016 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\output;
+
+/**
+ * Class allowing different systems for mapping and rendering icons.
+ *
+ * Possible icon styles are:
+ *   1. standard - image tags are generated which point to pix icons stored in a plugin pix folder.
+ *   2. fontawesome - font awesome markup is generated with the name of the icon mapped from the moodle icon name.
+ *   3. inline - inline tags are used for svg and png so no separate page requests are made (at the expense of page size).
+ *
+ * @package    core
+ * @category   output
+ * @copyright  2016 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class icon_system_fontawesome extends icon_system_font {
+
+    public function get_core_icon_map() {
+        return [
+            'core:docs' => 'fa-info-circle',
+            'core:help' => 'fa-question-circle',
+            'core:req' => 'fa-exclamation-circle',
+            'core:a/add_file' => 'fa-file-o',
+            'core:a/create_folder' => 'fa-folder-o',
+            'core:a/download_all' => 'fa-download',
+            'core:a/help' => 'fa-question-circle',
+            'core:a/logout' => 'fa-sign-out',
+            'core:a/refresh' => 'fa-refresh',
+            'core:a/search' => 'fa-search',
+            'core:a/setting' => 'fa-cog',
+            'core:a/view_icon_active' => 'fa-th',
+            'core:a/view_list_active' => 'fa-list',
+            'core:a/view_tree_active' => 'fa-folder',
+            'core:b/bookmark-new' => 'fa-bookmark',
+            'core:b/document-edit' => 'fa-pencil',
+            'core:b/document-new' => 'fa-file-o',
+            'core:b/document-properties' => 'fa-info',
+            'core:b/edit-copy' => 'fa-files-o',
+            'core:b/edit-delete' => 'fa-trash',
+            'core:e/abbr' => 'fa-comment',
+            'core:e/absolute' => 'fa-crosshairs',
+            'core:e/accessibility_checker' => 'fa-universal-access',
+            'core:e/acronym' => 'fa-comment',
+            'core:e/advance_hr' => 'fa-arrows-h',
+            'core:e/align_center' => 'fa-align-center',
+            'core:e/align_left' => 'fa-align-left',
+            'core:e/align_right' => 'fa-align-right',
+            'core:e/anchor' => 'fa-chain',
+            'core:e/backward' => 'fa-undo',
+            'core:e/bold' => 'fa-bold',
+            'core:e/bullet_list' => 'fa-list-ul',
+            'core:e/cell_props' => 'fa-info',
+            'core:e/cite' => 'fa-quote-right',
+            'core:e/cleanup_messy_code' => 'fa-eraser',
+            'core:e/clear_formatting' => 'fa-fire',
+            'core:e/copy' => 'fa-clone',
+            'core:e/cut' => 'fa-scissors',
+            'core:e/decrease_indent' => 'fa-outdent',
+            'core:e/delete_col' => 'fa-minus',
+            'core:e/delete_row' => 'fa-minus',
+            'core:e/delete' => 'fa-minus',
+            'core:e/delete_table' => 'fa-minus',
+            'core:e/document_properties' => 'fa-info',
+            'core:e/emoticons' => 'fa-meh-o',
+            'core:e/find_replace' => 'fa-search-plus',
+            'core:e/forward' => 'fa-arrow-right',
+            'core:e/fullpage' => 'fa-arrows-alt',
+            'core:e/fullscreen' => 'fa-arrows-alt',
+            'core:e/help' => 'fa-question-circle',
+            'core:e/increase_indent' => 'fa-indent',
+            'core:e/insert_col_after' => 'fa-columns',
+            'core:e/insert_col_before' => 'fa-columns',
+            'core:e/insert_date' => 'fa-calendar',
+            'core:e/insert_edit_image' => 'fa-picture-o',
+            'core:e/insert_edit_link' => 'fa-link',
+            'core:e/insert_edit_video' => 'fa-video-camera',
+            'core:e/insert_file' => 'fa-file',
+            'core:e/insert_horizontal_ruler' => 'fa-arrows-h',
+            'core:e/insert_nonbreaking_space' => 'fa-square-o',
+            'core:e/insert_page_break' => 'fa-level-down',
+            'core:e/insert_row_after' => 'fa-plus',
+            'core:e/insert_row_before' => 'fa-plus',
+            'core:e/insert' => 'fa-plus',
+            'core:e/insert_time' => 'fa-clock-o',
+            'core:e/italic' => 'fa-italic',
+            'core:e/justify' => 'fa-align-justify',
+            'core:e/layers_over' => 'fa-level-up',
+            'core:e/layers' => 'fa-window-restore',
+            'core:e/layers_under' => 'fa-level-down',
+            'core:e/left_to_right' => 'fa-chevron-right',
+            'core:e/manage_files' => 'fa-files-o',
+            'core:e/math' => 'fa-calculator',
+            'core:e/merge_cells' => 'fa-compress',
+            'core:e/new_document' => 'fa-file-o',
+            'core:e/numbered_list' => 'fa-list-ol',
+            'core:e/page_break' => 'fa-level-down',
+            'core:e/paste' => 'fa-clipboard',
+            'core:e/paste_text' => 'fa-clipboard',
+            'core:e/paste_word' => 'fa-clipboard',
+            'core:e/prevent_autolink' => 'fa-exclamation',
+            'core:e/preview' => 'fa-search-plus',
+            'core:e/print' => 'fa-print',
+            'core:e/question' => 'fa-question',
+            'core:e/redo' => 'fa-repeat',
+            'core:e/remove_link' => 'fa-remove',
+            'core:e/remove_page_break' => 'fa-remove',
+            'core:e/resize' => 'fa-expand',
+            'core:e/restore_draft' => 'fa-undo',
+            'core:e/restore_last_draft' => 'fa-undo',
+            'core:e/right_to_left' => 'fa-chevron-left',
+            'core:e/row_props' => 'fa-info',
+            'core:e/save' => 'fa-floppy-o',
+            'core:e/screenreader_helper' => 'fa-braille',
+            'core:e/search' => 'fa-search',
+            'core:e/select_all' => 'fa-arrows-h',
+            'core:e/show_invisible_characters' => 'fa-eye',
+            'core:e/source_code' => 'fa-code',
+            'core:e/special_character' => 'fa-heart',
+            'core:e/spellcheck' => 'fa-check',
+            'core:e/split_cells' => 'fa-columns',
+            'core:e/strikethrough' => 'fa-strikethrough',
+            'core:e/styleprops' => 'fa-info',
+            'core:e/subscript' => 'fa-subscript',
+            'core:e/superscript' => 'fa-superscript',
+            'core:e/table_props' => 'fa-table',
+            'core:e/table' => 'fa-table',
+            'core:e/template' => 'fa-sticky-note',
+            'core:e/text_color_picker' => 'fa-paint-brush',
+            'core:e/text_color' => 'fa-paint-brush',
+            'core:e/text_highlight_picker' => 'fa-lightbulb-o',
+            'core:e/text_highlight' => 'fa-lightbulb-o',
+            'core:e/tick' => 'fa-check',
+            'core:e/toggle_blockquote' => 'fa-quote-left',
+            'core:e/underline' => 'fa-underline',
+            'core:e/undo' => 'fa-undo',
+            'core:e/visual_aid' => 'fa-universal-access',
+            'core:e/visual_blocks' => 'fa-audio-description',
+            'core:f/archive' => 'fa-file-zip-o',
+            'core:f/archive-24' => 'fa-file-zip-o',
+            'core:f/archive-32' => 'fa-file-zip-o',
+            'core:f/archive-48' => 'fa-file-zip-o',
+            'core:f/archive-64' => 'fa-file-zip-o',
+            'core:f/archive-72' => 'fa-file-zip-o',
+            'core:f/archive-80' => 'fa-file-zip-o',
+            'core:f/archive-96' => 'fa-file-zip-o',
+            'core:f/archive-128' => 'fa-file-zip-o',
+            'core:f/archive-256' => 'fa-file-zip-o',
+            'core:f/audio' => 'fa-file-audio-o',
+            'core:f/audio-24' => 'fa-file-audio-o',
+            'core:f/audio-32' => 'fa-file-audio-o',
+            'core:f/audio-48' => 'fa-file-audio-o',
+            'core:f/audio-64' => 'fa-file-audio-o',
+            'core:f/audio-72' => 'fa-file-audio-o',
+            'core:f/audio-80' => 'fa-file-audio-o',
+            'core:f/audio-96' => 'fa-file-audio-o',
+            'core:f/audio-128' => 'fa-file-audio-o',
+            'core:f/audio-256' => 'fa-file-audio-o',
+            'core:f/avi' => 'fa-file-movie-o',
+            'core:f/avi-24' => 'fa-file-movie-o',
+            'core:f/avi-32' => 'fa-file-movie-o',
+            'core:f/avi-48' => 'fa-file-movie-o',
+            'core:f/avi-64' => 'fa-file-movie-o',
+            'core:f/avi-72' => 'fa-file-movie-o',
+            'core:f/avi-80' => 'fa-file-movie-o',
+            'core:f/avi-96' => 'fa-file-movie-o',
+            'core:f/avi-128' => 'fa-file-movie-o',
+            'core:f/avi-256' => 'fa-file-movie-o',
+            'core:f/base' => 'fa-file-o',
+            'core:f/base-24' => 'fa-file-o',
+            'core:f/base-32' => 'fa-file-o',
+            'core:f/base-48' => 'fa-file-o',
+            'core:f/base-64' => 'fa-file-o',
+            'core:f/base-72' => 'fa-file-o',
+            'core:f/base-80' => 'fa-file-o',
+            'core:f/base-96' => 'fa-file-o',
+            'core:f/base-128' => 'fa-file-o',
+            'core:f/base-256' => 'fa-file-o',
+            'core:f/bmp' => 'fa-file-image-o',
+            'core:f/bmp-24' => 'fa-file-image-o',
+            'core:f/bmp-32' => 'fa-file-image-o',
+            'core:f/bmp-48' => 'fa-file-image-o',
+            'core:f/bmp-64' => 'fa-file-image-o',
+            'core:f/bmp-72' => 'fa-file-image-o',
+            'core:f/bmp-80' => 'fa-file-image-o',
+            'core:f/bmp-96' => 'fa-file-image-o',
+            'core:f/bmp-128' => 'fa-file-image-o',
+            'core:f/bmp-256' => 'fa-file-image-o',
+            'core:f/calc' => 'fa-file-excel-o',
+            'core:f/calc-24' => 'fa-file-excel-o',
+            'core:f/calc-32' => 'fa-file-excel-o',
+            'core:f/calc-48' => 'fa-file-excel-o',
+            'core:f/calc-64' => 'fa-file-excel-o',
+            'core:f/calc-72' => 'fa-file-excel-o',
+            'core:f/calc-80' => 'fa-file-excel-o',
+            'core:f/calc-96' => 'fa-file-excel-o',
+            'core:f/calc-128' => 'fa-file-excel-o',
+            'core:f/calc-256' => 'fa-file-excel-o',
+            'core:f/chart' => 'fa-bar-chart',
+            'core:f/chart-24' => 'fa-bar-chart',
+            'core:f/chart-32' => 'fa-bar-chart',
+            'core:f/chart-48' => 'fa-bar-chart',
+            'core:f/chart-64' => 'fa-bar-chart',
+            'core:f/chart-72' => 'fa-bar-chart',
+            'core:f/chart-80' => 'fa-bar-chart',
+            'core:f/chart-96' => 'fa-bar-chart',
+            'core:f/chart-128' => 'fa-bar-chart',
+            'core:f/chart-256' => 'fa-bar-chart',
+            'core:f/database' => 'fa-database',
+            'core:f/database-24' => 'fa-database',
+            'core:f/database-32' => 'fa-database',
+            'core:f/database-48' => 'fa-database',
+            'core:f/database-64' => 'fa-database',
+            'core:f/database-72' => 'fa-database',
+            'core:f/database-80' => 'fa-database',
+            'core:f/database-96' => 'fa-database',
+            'core:f/database-128' => 'fa-database',
+            'core:f/database-256' => 'fa-database',
+            'core:f/document' => 'fa-file',
+            'core:f/document-24' => 'fa-file',
+            'core:f/document-32' => 'fa-file',
+            'core:f/document-48' => 'fa-file',
+            'core:f/document-64' => 'fa-file',
+            'core:f/document-72' => 'fa-file',
+            'core:f/document-80' => 'fa-file',
+            'core:f/document-96' => 'fa-file',
+            'core:f/document-128' => 'fa-file',
+            'core:f/document-256' => 'fa-file',
+            'core:f/draw' => 'fa-file-image-o',
+            'core:f/draw-24' => 'fa-file-image-o',
+            'core:f/draw-32' => 'fa-file-image-o',
+            'core:f/draw-48' => 'fa-file-image-o',
+            'core:f/draw-64' => 'fa-file-image-o',
+            'core:f/draw-72' => 'fa-file-image-o',
+            'core:f/draw-80' => 'fa-file-image-o',
+            'core:f/draw-96' => 'fa-file-image-o',
+            'core:f/draw-128' => 'fa-file-image-o',
+            'core:f/draw-256' => 'fa-file-image-o',
+            'core:f/eps' => 'fa-file-pdf-o',
+            'core:f/eps-24' => 'fa-file-pdf-o',
+            'core:f/eps-32' => 'fa-file-pdf-o',
+            'core:f/eps-48' => 'fa-file-pdf-o',
+            'core:f/eps-64' => 'fa-file-pdf-o',
+            'core:f/eps-72' => 'fa-file-pdf-o',
+            'core:f/eps-80' => 'fa-file-pdf-o',
+            'core:f/eps-96' => 'fa-file-pdf-o',
+            'core:f/eps-128' => 'fa-file-pdf-o',
+            'core:f/eps-256' => 'fa-file-pdf-o',
+            'core:f/epub' => 'fa-book',
+            'core:f/epub-24' => 'fa-book',
+            'core:f/epub-32' => 'fa-book',
+            'core:f/epub-48' => 'fa-book',
+            'core:f/epub-64' => 'fa-book',
+            'core:f/epub-72' => 'fa-book',
+            'core:f/epub-80' => 'fa-book',
+            'core:f/epub-96' => 'fa-book',
+            'core:f/epub-128' => 'fa-book',
+            'core:f/epub-256' => 'fa-book',
+            'core:f/flash' => 'fa-flash',
+            'core:f/flash-24' => 'fa-flash',
+            'core:f/flash-32' => 'fa-flash',
+            'core:f/flash-48' => 'fa-flash',
+            'core:f/flash-64' => 'fa-flash',
+            'core:f/flash-72' => 'fa-flash',
+            'core:f/flash-80' => 'fa-flash',
+            'core:f/flash-96' => 'fa-flash',
+            'core:f/flash-128' => 'fa-flash',
+            'core:f/flash-256' => 'fa-flash',
+            'core:f/folder' => 'fa-folder',
+            'core:f/folder-24' => 'fa-folder',
+            'core:f/folder-32' => 'fa-folder',
+            'core:f/folder-48' => 'fa-folder',
+            'core:f/folder-64' => 'fa-folder',
+            'core:f/folder-72' => 'fa-folder',
+            'core:f/folder-80' => 'fa-folder',
+            'core:f/folder-96' => 'fa-folder',
+            'core:f/folder-128' => 'fa-folder',
+            'core:f/folder-256' => 'fa-folder',
+            'core:f/folder-open' => 'fa-folder-open',
+            'core:f/folder-open-24' => 'fa-folder-open',
+            'core:f/folder-open-32' => 'fa-folder-open',
+            'core:f/folder-open-48' => 'fa-folder-open',
+            'core:f/folder-open-64' => 'fa-folder-open',
+            'core:f/folder-open-72' => 'fa-folder-open',
+            'core:f/folder-open-80' => 'fa-folder-open',
+            'core:f/folder-open-96' => 'fa-folder-open',
+            'core:f/folder-open-128' => 'fa-folder-open',
+            'core:f/folder-open-256' => 'fa-folder-open',
+            'core:f/gif' => 'fa-file-image-o',
+            'core:f/gif-24' => 'fa-file-image-o',
+            'core:f/gif-32' => 'fa-file-image-o',
+            'core:f/gif-48' => 'fa-file-image-o',
+            'core:f/gif-64' => 'fa-file-image-o',
+            'core:f/gif-72' => 'fa-file-image-o',
+            'core:f/gif-80' => 'fa-file-image-o',
+            'core:f/gif-96' => 'fa-file-image-o',
+            'core:f/gif-128' => 'fa-file-image-o',
+            'core:f/gif-256' => 'fa-file-image-o',
+            'core:f/html' => 'fa-file-code-o',
+            'core:f/html-24' => 'fa-file-code-o',
+            'core:f/html-32' => 'fa-file-code-o',
+            'core:f/html-48' => 'fa-file-code-o',
+            'core:f/html-64' => 'fa-file-code-o',
+            'core:f/html-72' => 'fa-file-code-o',
+            'core:f/html-80' => 'fa-file-code-o',
+            'core:f/html-96' => 'fa-file-code-o',
+            'core:f/html-128' => 'fa-file-code-o',
+            'core:f/html-256' => 'fa-file-code-o',
+            'core:f/image' => 'fa-file-image-o',
+            'core:f/image-24' => 'fa-file-image-o',
+            'core:f/image-32' => 'fa-file-image-o',
+            'core:f/image-48' => 'fa-file-image-o',
+            'core:f/image-64' => 'fa-file-image-o',
+            'core:f/image-72' => 'fa-file-image-o',
+            'core:f/image-80' => 'fa-file-image-o',
+            'core:f/image-96' => 'fa-file-image-o',
+            'core:f/image-128' => 'fa-file-image-o',
+            'core:f/image-256' => 'fa-file-image-o',
+            'core:f/impress' => 'fa-file-powerpoint-o',
+            'core:f/impress-24' => 'fa-file-powerpoint-o',
+            'core:f/impress-32' => 'fa-file-powerpoint-o',
+            'core:f/impress-48' => 'fa-file-powerpoint-o',
+            'core:f/impress-64' => 'fa-file-powerpoint-o',
+            'core:f/impress-72' => 'fa-file-powerpoint-o',
+            'core:f/impress-80' => 'fa-file-powerpoint-o',
+            'core:f/impress-96' => 'fa-file-powerpoint-o',
+            'core:f/impress-128' => 'fa-file-powerpoint-o',
+            'core:f/impress-256' => 'fa-file-powerpoint-o',
+            'core:f/isf' => 'fa-file-image-o',
+            'core:f/isf-24' => 'fa-file-image-o',
+            'core:f/isf-32' => 'fa-file-image-o',
+            'core:f/isf-48' => 'fa-file-image-o',
+            'core:f/isf-64' => 'fa-file-image-o',
+            'core:f/isf-72' => 'fa-file-image-o',
+            'core:f/isf-80' => 'fa-file-image-o',
+            'core:f/isf-96' => 'fa-file-image-o',
+            'core:f/isf-128' => 'fa-file-image-o',
+            'core:f/isf-256' => 'fa-file-image-o',
+            'core:f/jpeg' => 'fa-file-image-o',
+            'core:f/jpeg-24' => 'fa-file-image-o',
+            'core:f/jpeg-32' => 'fa-file-image-o',
+            'core:f/jpeg-48' => 'fa-file-image-o',
+            'core:f/jpeg-64' => 'fa-file-image-o',
+            'core:f/jpeg-72' => 'fa-file-image-o',
+            'core:f/jpeg-80' => 'fa-file-image-o',
+            'core:f/jpeg-96' => 'fa-file-image-o',
+            'core:f/jpeg-128' => 'fa-file-image-o',
+            'core:f/jpeg-256' => 'fa-file-image-o',
+            'core:f/markup' => 'fa-file-code-o',
+            'core:f/markup-24' => 'fa-file-code-o',
+            'core:f/markup-32' => 'fa-file-code-o',
+            'core:f/markup-48' => 'fa-file-code-o',
+            'core:f/markup-64' => 'fa-file-code-o',
+            'core:f/markup-72' => 'fa-file-code-o',
+            'core:f/markup-80' => 'fa-file-code-o',
+            'core:f/markup-96' => 'fa-file-code-o',
+            'core:f/markup-128' => 'fa-file-code-o',
+            'core:f/markup-256' => 'fa-file-code-o',
+            'core:f/math' => 'fa-calculator',
+            'core:f/math-24' => 'fa-calculator',
+            'core:f/math-32' => 'fa-calculator',
+            'core:f/math-48' => 'fa-calculator',
+            'core:f/math-64' => 'fa-calculator',
+            'core:f/math-72' => 'fa-calculator',
+            'core:f/math-80' => 'fa-calculator',
+            'core:f/math-96' => 'fa-calculator',
+            'core:f/math-128' => 'fa-calculator',
+            'core:f/math-256' => 'fa-calculator',
+            'core:f/moodle' => 'fa-graduation-cap',
+            'core:f/moodle-24' => 'fa-graduation-cap',
+            'core:f/moodle-32' => 'fa-graduation-cap',
+            'core:f/moodle-48' => 'fa-graduation-cap',
+            'core:f/moodle-64' => 'fa-graduation-cap',
+            'core:f/moodle-72' => 'fa-graduation-cap',
+            'core:f/moodle-80' => 'fa-graduation-cap',
+            'core:f/moodle-96' => 'fa-graduation-cap',
+            'core:f/moodle-128' => 'fa-graduation-cap',
+            'core:f/moodle-256' => 'fa-graduation-cap',
+            'core:f/mp3' => 'fa-file-audio-o',
+            'core:f/mp3-24' => 'fa-file-audio-o',
+            'core:f/mp3-32' => 'fa-file-audio-o',
+            'core:f/mp3-48' => 'fa-file-audio-o',
+            'core:f/mp3-64' => 'fa-file-audio-o',
+            'core:f/mp3-72' => 'fa-file-audio-o',
+            'core:f/mp3-80' => 'fa-file-audio-o',
+            'core:f/mp3-96' => 'fa-file-audio-o',
+            'core:f/mp3-128' => 'fa-file-audio-o',
+            'core:f/mp3-256' => 'fa-file-audio-o',
+            'core:f/mpeg' => 'fa-file-video-o',
+            'core:f/mpeg-24' => 'fa-file-video-o',
+            'core:f/mpeg-32' => 'fa-file-video-o',
+            'core:f/mpeg-48' => 'fa-file-video-o',
+            'core:f/mpeg-64' => 'fa-file-video-o',
+            'core:f/mpeg-72' => 'fa-file-video-o',
+            'core:f/mpeg-80' => 'fa-file-video-o',
+            'core:f/mpeg-96' => 'fa-file-video-o',
+            'core:f/mpeg-128' => 'fa-file-video-o',
+            'core:f/mpeg-256' => 'fa-file-video-o',
+            'core:f/oth' => 'fa-file-o',
+            'core:f/oth-24' => 'fa-file-o',
+            'core:f/oth-32' => 'fa-file-o',
+            'core:f/oth-48' => 'fa-file-o',
+            'core:f/oth-64' => 'fa-file-o',
+            'core:f/oth-72' => 'fa-file-o',
+            'core:f/oth-80' => 'fa-file-o',
+            'core:f/oth-96' => 'fa-file-o',
+            'core:f/oth-128' => 'fa-file-o',
+            'core:f/oth-256' => 'fa-file-o',
+            'core:f/pdf' => 'fa-file-pdf-o',
+            'core:f/pdf-24' => 'fa-file-pdf-o',
+            'core:f/pdf-32' => 'fa-file-pdf-o',
+            'core:f/pdf-48' => 'fa-file-pdf-o',
+            'core:f/pdf-64' => 'fa-file-pdf-o',
+            'core:f/pdf-72' => 'fa-file-pdf-o',
+            'core:f/pdf-80' => 'fa-file-pdf-o',
+            'core:f/pdf-96' => 'fa-file-pdf-o',
+            'core:f/pdf-128' => 'fa-file-pdf-o',
+            'core:f/pdf-256' => 'fa-file-pdf-o',
+            'core:f/png' => 'fa-file-image-o',
+            'core:f/png-24' => 'fa-file-image-o',
+            'core:f/png-32' => 'fa-file-image-o',
+            'core:f/png-48' => 'fa-file-image-o',
+            'core:f/png-64' => 'fa-file-image-o',
+            'core:f/png-72' => 'fa-file-image-o',
+            'core:f/png-80' => 'fa-file-image-o',
+            'core:f/png-96' => 'fa-file-image-o',
+            'core:f/png-128' => 'fa-file-image-o',
+            'core:f/png-256' => 'fa-file-image-o',
+            'core:f/powerpoint' => 'fa-file-powerpoint-o',
+            'core:f/powerpoint-24' => 'fa-file-powerpoint-o',
+            'core:f/powerpoint-32' => 'fa-file-powerpoint-o',
+            'core:f/powerpoint-48' => 'fa-file-powerpoint-o',
+            'core:f/powerpoint-64' => 'fa-file-powerpoint-o',
+            'core:f/powerpoint-72' => 'fa-file-powerpoint-o',
+            'core:f/powerpoint-80' => 'fa-file-powerpoint-o',
+            'core:f/powerpoint-96' => 'fa-file-powerpoint-o',
+            'core:f/powerpoint-128' => 'fa-file-powerpoint-o',
+            'core:f/powerpoint-256' => 'fa-file-powerpoint-o',
+            'core:f/psd' => 'fa-file-image-o',
+            'core:f/psd-24' => 'fa-file-image-o',
+            'core:f/psd-32' => 'fa-file-image-o',
+            'core:f/psd-48' => 'fa-file-image-o',
+            'core:f/psd-64' => 'fa-file-image-o',
+            'core:f/psd-72' => 'fa-file-image-o',
+            'core:f/psd-80' => 'fa-file-image-o',
+            'core:f/psd-96' => 'fa-file-image-o',
+            'core:f/psd-128' => 'fa-file-image-o',
+            'core:f/psd-256' => 'fa-file-image-o',
+            'core:f/publisher' => 'fa-file-image-o',
+            'core:f/publisher-24' => 'fa-file-image-o',
+            'core:f/publisher-32' => 'fa-file-image-o',
+            'core:f/publisher-48' => 'fa-file-image-o',
+            'core:f/publisher-64' => 'fa-file-image-o',
+            'core:f/publisher-72' => 'fa-file-image-o',
+            'core:f/publisher-80' => 'fa-file-image-o',
+            'core:f/publisher-96' => 'fa-file-image-o',
+            'core:f/publisher-128' => 'fa-file-image-o',
+            'core:f/publisher-256' => 'fa-file-image-o',
+            'core:f/quicktime' => 'fa-file-video-o',
+            'core:f/quicktime-24' => 'fa-file-video-o',
+            'core:f/quicktime-32' => 'fa-file-video-o',
+            'core:f/quicktime-48' => 'fa-file-video-o',
+            'core:f/quicktime-64' => 'fa-file-video-o',
+            'core:f/quicktime-72' => 'fa-file-video-o',
+            'core:f/quicktime-80' => 'fa-file-video-o',
+            'core:f/quicktime-96' => 'fa-file-video-o',
+            'core:f/quicktime-128' => 'fa-file-video-o',
+            'core:f/quicktime-256' => 'fa-file-video-o',
+            'core:f/sourcecode' => 'fa-file-code-o',
+            'core:f/sourcecode-24' => 'fa-file-code-o',
+            'core:f/sourcecode-32' => 'fa-file-code-o',
+            'core:f/sourcecode-48' => 'fa-file-code-o',
+            'core:f/sourcecode-64' => 'fa-file-code-o',
+            'core:f/sourcecode-72' => 'fa-file-code-o',
+            'core:f/sourcecode-80' => 'fa-file-code-o',
+            'core:f/sourcecode-96' => 'fa-file-code-o',
+            'core:f/sourcecode-128' => 'fa-file-code-o',
+            'core:f/sourcecode-256' => 'fa-file-code-o',
+            'core:f/spreadsheet' => 'fa-file-excel-o',
+            'core:f/spreadsheet-24' => 'fa-file-excel-o',
+            'core:f/spreadsheet-32' => 'fa-file-excel-o',
+            'core:f/spreadsheet-48' => 'fa-file-excel-o',
+            'core:f/spreadsheet-64' => 'fa-file-excel-o',
+            'core:f/spreadsheet-72' => 'fa-file-excel-o',
+            'core:f/spreadsheet-80' => 'fa-file-excel-o',
+            'core:f/spreadsheet-96' => 'fa-file-excel-o',
+            'core:f/spreadsheet-128' => 'fa-file-excel-o',
+            'core:f/spreadsheet-256' => 'fa-file-excel-o',
+            'core:f/text' => 'fa-file-text-o',
+            'core:f/text-24' => 'fa-file-text-o',
+            'core:f/text-32' => 'fa-file-text-o',
+            'core:f/text-48' => 'fa-file-text-o',
+            'core:f/text-64' => 'fa-file-text-o',
+            'core:f/text-72' => 'fa-file-text-o',
+            'core:f/text-80' => 'fa-file-text-o',
+            'core:f/text-96' => 'fa-file-text-o',
+            'core:f/text-128' => 'fa-file-text-o',
+            'core:f/text-256' => 'fa-file-text-o',
+            'core:f/tiff' => 'fa-file-image-o',
+            'core:f/tiff-24' => 'fa-file-image-o',
+            'core:f/tiff-32' => 'fa-file-image-o',
+            'core:f/tiff-48' => 'fa-file-image-o',
+            'core:f/tiff-64' => 'fa-file-image-o',
+            'core:f/tiff-72' => 'fa-file-image-o',
+            'core:f/tiff-80' => 'fa-file-image-o',
+            'core:f/tiff-96' => 'fa-file-image-o',
+            'core:f/tiff-128' => 'fa-file-image-o',
+            'core:f/tiff-256' => 'fa-file-image-o',
+            'core:f/unknown' => 'fa-file-o',
+            'core:f/unknown-24' => 'fa-file-o',
+            'core:f/unknown-32' => 'fa-file-o',
+            'core:f/unknown-48' => 'fa-file-o',
+            'core:f/unknown-64' => 'fa-file-o',
+            'core:f/unknown-72' => 'fa-file-o',
+            'core:f/unknown-80' => 'fa-file-o',
+            'core:f/unknown-96' => 'fa-file-o',
+            'core:f/unknown-128' => 'fa-file-o',
+            'core:f/unknown-256' => 'fa-file-o',
+            'core:f/video' => 'fa-file-video-o',
+            'core:f/video-24' => 'fa-file-video-o',
+            'core:f/video-32' => 'fa-file-video-o',
+            'core:f/video-48' => 'fa-file-video-o',
+            'core:f/video-64' => 'fa-file-video-o',
+            'core:f/video-72' => 'fa-file-video-o',
+            'core:f/video-80' => 'fa-file-video-o',
+            'core:f/video-96' => 'fa-file-video-o',
+            'core:f/video-128' => 'fa-file-video-o',
+            'core:f/video-256' => 'fa-file-video-o',
+            'core:f/wav' => 'fa-file-audio-o',
+            'core:f/wav-24' => 'fa-file-audio-o',
+            'core:f/wav-32' => 'fa-file-audio-o',
+            'core:f/wav-48' => 'fa-file-audio-o',
+            'core:f/wav-64' => 'fa-file-audio-o',
+            'core:f/wav-72' => 'fa-file-audio-o',
+            'core:f/wav-80' => 'fa-file-audio-o',
+            'core:f/wav-96' => 'fa-file-audio-o',
+            'core:f/wav-128' => 'fa-file-audio-o',
+            'core:f/wav-256' => 'fa-file-audio-o',
+            'core:f/wmv' => 'fa-file-video-o',
+            'core:f/wmv-24' => 'fa-file-video-o',
+            'core:f/wmv-32' => 'fa-file-video-o',
+            'core:f/wmv-48' => 'fa-file-video-o',
+            'core:f/wmv-64' => 'fa-file-video-o',
+            'core:f/wmv-72' => 'fa-file-video-o',
+            'core:f/wmv-80' => 'fa-file-video-o',
+            'core:f/wmv-96' => 'fa-file-video-o',
+            'core:f/wmv-128' => 'fa-file-video-o',
+            'core:f/wmv-256' => 'fa-file-video-o',
+            'core:f/writer' => 'fa-file-word-o',
+            'core:f/writer-24' => 'fa-file-word-o',
+            'core:f/writer-32' => 'fa-file-word-o',
+            'core:f/writer-48' => 'fa-file-word-o',
+            'core:f/writer-64' => 'fa-file-word-o',
+            'core:f/writer-72' => 'fa-file-word-o',
+            'core:f/writer-80' => 'fa-file-word-o',
+            'core:f/writer-96' => 'fa-file-word-o',
+            'core:f/writer-128' => 'fa-file-word-o',
+            'core:f/writer-256' => 'fa-file-word-o',
+            'theme:fp/add_file' => 'fa-file-o',
+            'theme:fp/alias' => 'fa-link',
+            'theme:fp/check' => 'fa-check',
+            'theme:fp/create_folder' => 'fa-folder',
+            'theme:fp/cross' => 'fa-remove',
+            'theme:fp/download_all' => 'fa-download',
+            'theme:fp/help' => 'fa-question-circle',
+            'theme:fp/link' => 'fa-link',
+            'theme:fp/link_sm' => 'fa-link',
+            'theme:fp/logout' => 'fa-sign-out',
+            'theme:fp/path_folder' => 'fa-folder',
+            'theme:fp/path_folder_rtl' => 'fa-folder',
+            'theme:fp/refresh' => 'fa-refresh',
+            'theme:fp/search' => 'fa-search',
+            'theme:fp/setting' => 'fa-cog',
+            'theme:fp/view_icon_active' => 'fa-th',
+            'theme:fp/view_list_active' => 'fa-list',
+            'theme:fp/view_tree_active' => 'fa-folder',
+            'core:i/assignroles' => 'fa-user-plus',
+            'core:i/backup' => 'fa-file-zip-o',
+            'core:i/badge' => 'fa-shield',
+            'core:i/calc' => 'fa-calculator',
+            'core:i/calendar' => 'fa-calendar',
+            'core:i/caution' => 'fa-exclamation',
+            'core:i/checked' => 'fa-check',
+            'core:i/checkpermissions' => 'fa-unlock-alt',
+            'core:i/cohort' => 'fa-users',
+            'core:i/competencies' => 'fa-check-square-o',
+            'core:i/completion-auto-enabled' => 'fa-check-square',
+            'core:i/completion-auto-fail' => 'fa-square-o',
+            'core:i/completion-auto-n' => 'fa-square-o',
+            'core:i/completion-auto-pass' => 'fa-check-square',
+            'core:i/completion-auto-y' => 'fa-check-square',
+            'core:i/completion-manual-enabled' => 'fa-square-o',
+            'core:i/completion-manual-y' => 'fa-check-square',
+            'core:i/completion-manual-n' => 'fa-minus-square',
+            'core:i/completion-self' => 'fa-user-o',
+            'core:i/lock' => 'fa-lock',
+            'core:i/courseevent' => 'fa-calendar',
+            'core:i/course' => 'fa-globe',
+            'core:i/db' => 'fa-database',
+            'core:i/delete' => 'fa-trash',
+            'core:i/down' => 'fa-arrow-down',
+            'core:i/dragdrop' => 'fa-arrows',
+            'core:i/duration' => 'fa-clock',
+            'core:i/edit' => 'fa-pencil',
+            'core:i/email' => 'fa-envelope',
+            'core:i/enrolmentsuspended' => 'fa-user-circle',
+            'core:i/enrolusers' => 'fa-user-plus',
+            'core:i/expired' => 'fa-exclamation',
+            'core:i/export' => 'fa-level-down',
+            'core:i/files' => 'fa-file',
+            'core:i/filter' => 'fa-filter',
+            'core:i/flagged' => 'fa-flag',
+            'core:i/folder' => 'fa-folder',
+            'core:i/grade_correct' => 'fa-check',
+            'core:i/grade_incorrect' => 'fa-remove',
+            'core:i/grade_partiallycorrect' => 'fa-check-square',
+            'core:i/grades' => 'fa-graduation-cap',
+            'core:i/groupevent' => 'fa-group',
+            'core:i/groupn' => 'fa-user',
+            'core:i/group' => 'fa-users',
+            'core:i/groups' => 'fa-user-circle-o',
+            'core:i/groupv' => 'fa-users',
+            'core:i/hide' => 'fa-eye',
+            'core:i/heirarchylock' => 'fa-lock',
+            'core:i/import' => 'fa-level-up',
+            'core:i/info' => 'fa-info',
+            'core:i/invalid' => 'fa-exclamation',
+            'core:i/item' => 'fa-circle',
+            'core:i/loading' => 'fa-circle-o-notch fa-spin',
+            'core:i/loading_small' => 'fa-circle-o-notch fa-spin',
+            'core:i/lock' => 'fa-lock',
+            'core:i/log' => 'fa-list-alt',
+            'core:i/mahara_host' => 'fa-id-badge',
+            'core:i/manual_item' => 'fa-square-o',
+            'core:i/marked' => 'fa-check-square',
+            'core:i/marker' => 'fa-user-o',
+            'core:i/mean' => 'fa-calculator',
+            'core:i/menu' => 'fa-ellipsis-v',
+            'core:i/mnethost' => 'fa-external-link',
+            'core:i/moodle_host' => 'fa-graduation-cap',
+            'core:i/move_2d' => 'fa-arrows',
+            'core:i/navigationitem' => 'fa-angle-right',
+            'core:i/ns_red_mark' => 'fa-remove',
+            'core:i/new' => 'fa-plus',
+            'core:i/news' => 'fa-newspaper',
+            'core:i/nosubcat' => 'fa-plus-square-o',
+            'core:i/notifications' => 'fa-bell',
+            'core:i/open' => 'fa-folder-open',
+            'core:i/outcomes' => 'fa-tasks',
+            'core:i/payment' => 'fa-money',
+            'core:i/permissionlock' => 'fa-lock',
+            'core:i/permissions' => 'fa-pencil-square-o',
+            'core:i/persona_sign_in_black' => 'fa-male',
+            'core:i/portfolio' => 'fa-id-badge',
+            'core:i/preview' => 'fa-search-plus',
+            'core:i/progressbar' => 'fa-spinner fa-spin',
+            'core:i/publish' => 'fa-share',
+            'core:i/questions' => 'fa-question',
+            'core:i/reload' => 'fa-refresh',
+            'core:i/report' => 'fa-area-chart',
+            'core:i/repository' => 'fa-hdd-o',
+            'core:i/restore' => 'fa-level-up',
+            'core:i/return' => 'fa-arrow-left',
+            'core:i/risk_config' => 'fa-cog',
+            'core:i/risk_managetrust' => 'fa-exclamation-triangle',
+            'core:i/risk_personal' => 'fa-user',
+            'core:i/risk_spam' => 'fa-trash',
+            'core:i/risk_xss' => 'fa-exchange',
+            'core:i/role' => 'fa-user-md',
+            'core:i/rss' => 'fa-rss',
+            'core:i/rsssitelogo' => 'fa-rss',
+            'core:i/scales' => 'fa-balance-scale',
+            'core:i/scheduled' => 'fa-calendar-check-o',
+            'core:i/search' => 'fa-search',
+            'core:i/settings' => 'fa-cogs',
+            'core:i/show' => 'fa-eye-slash',
+            'core:i/siteevent' => 'fa-share-alt',
+            'core:i/starrating' => 'fa-star',
+            'core:i/stats' => 'fa-line-chart',
+            'core:i/switch' => 'fa-exchange',
+            'core:i/switchrole' => 'fa-user-secret',
+            'core:i/twoway' => 'fa-arrows-h',
+            'core:i/unchecked' => 'fa-square-o',
+            'core:i/unflagged' => 'fa-flag-o',
+            'core:i/unlock' => 'fa-unlock',
+            'core:i/up' => 'fa-arrow-up',
+            'core:i/userevent' => 'fa-user',
+            'core:i/user' => 'fa-user',
+            'core:i/users' => 'fa-users',
+            'core:i/valid' => 'fa-check-square-o',
+            'core:i/warning' => 'fa-exclamation',
+            'core:i/withsubcat' => 'fa-plus-square',
+            'core:m/USD' => 'fa-usd',
+            'core:t/addcontact' => 'fa-address-card',
+            'core:t/add' => 'fa-plus',
+            'core:t/approve' => 'fa-thumbs-up',
+            'core:t/assignroles' => 'fa-user-circle',
+            'core:t/award' => 'fa-trophy',
+            'core:t/backpack' => 'fa-shopping-bag',
+            'core:t/backup' => 'fa-arrow-circle-down',
+            'core:t/block' => 'fa-commenting-o',
+            'core:t/block_to_dock_rtl' => 'fa-chevron-right',
+            'core:t/block_to_dock' => 'fa-chevron-left',
+            'core:t/calc_off' => 'fa-times',
+            'core:t/calc' => 'fa-calculator',
+            'core:t/check' => 'fa-check',
+            'core:t/cohort' => 'fa-users',
+            'core:t/collapsed_empty_rtl' => 'fa-plus-square-o',
+            'core:t/collapsed_empty' => 'fa-plus-square-o',
+            'core:t/collapsed_rtl' => 'fa-plus-square',
+            'core:t/collapsed' => 'fa-plus-square',
+            'core:t/contextmenu' => 'fa-cog',
+            'core:t/copy' => 'fa-copy',
+            'core:t/delete' => 'fa-trash',
+            'core:t/dockclose' => 'fa-window-close',
+            'core:t/dock_to_block_rtl' => 'fa-chevron-right',
+            'core:t/dock_to_block' => 'fa-chevron-left',
+            'core:t/download' => 'fa-download',
+            'core:t/down' => 'fa-arrow-down',
+            'core:t/dropdown' => 'fa-cog',
+            'core:t/editinline' => 'fa-pencil',
+            'core:t/edit_menu' => 'fa-cog',
+            'core:t/editstring' => 'fa-pencil',
+            'core:t/edit' => 'fa-cog',
+            'core:t/emailno' => 'fa-envelope-o',
+            'core:t/email' => 'fa-envelope',
+            'core:t/enrolusers' => 'fa-user-plus',
+            'core:t/expanded' => 'fa-caret-down',
+            'core:t/go' => 'fa-arrow-right',
+            'core:t/grades' => 'fa-graduation-cap',
+            'core:t/groupn' => 'fa-users',
+            'core:t/groups' => 'fa-users',
+            'core:t/groupv' => 'fa-users',
+            'core:t/hide' => 'fa-eye',
+            'core:t/left' => 'fa-arrow-left',
+            'core:t/less' => 'fa-caret-up',
+            'core:t/locked' => 'fa-lock',
+            'core:t/lock' => 'fa-lock',
+            'core:t/locktime' => 'fa-lock',
+            'core:t/markasread' => 'fa-check',
+            'core:t/messages' => 'fa-comments',
+            'core:t/message' => 'fa-comment',
+            'core:t/more' => 'fa-caret-down',
+            'core:t/move' => 'fa-arrows',
+            'core:t/passwordunmask-edit' => 'fa-pencil',
+            'core:t/passwordunmask-reveal' => 'fa-eye',
+            'core:t/portfolioadd' => 'fa-plus',
+            'core:t/preferences' => 'fa-wrench',
+            'core:t/preview' => 'fa-search-plus',
+            'core:t/print' => 'fa-print',
+            'core:t/removecontact' => 'fa-user-times',
+            'core:t/reset' => 'fa-repeat',
+            'core:t/restore' => 'fa-arrow-circle-up',
+            'core:t/right' => 'fa-arrow-right',
+            'core:t/show' => 'fa-eye-slash',
+            'core:t/sort_asc' => 'fa-sort-asc',
+            'core:t/sort_desc' => 'fa-sort-desc',
+            'core:t/sort' => 'fa-sort',
+            'core:t/stop' => 'fa-stop',
+            'core:t/switch_minus' => 'fa-minus',
+            'core:t/switch_plus' => 'fa-plus',
+            'core:t/switch_whole' => 'fa-square-o',
+            'core:t/unblock' => 'fa-commenting',
+            'core:t/unlocked' => 'fa-unlock-alt',
+            'core:t/unlock' => 'fa-unlock',
+            'core:t/up' => 'fa-arrow-up',
+            'core:t/user' => 'fa-user',
+            'core:t/viewdetails' => 'fa-list',
+        ];
+    }
+}
+
diff --git a/lib/classes/output/icon_system_standard.php b/lib/classes/output/icon_system_standard.php
new file mode 100644 (file)
index 0000000..3d38356
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Contains class \core\output\icon_system_standard
+ *
+ * @package    core
+ * @category   output
+ * @copyright  2016 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core\output;
+
+use renderer_base;
+use pix_icon;
+
+/**
+ * Standard icon rendering. No mapping - img tags used.
+ *
+ * @package    core
+ * @category   output
+ * @copyright  2016 Damyon Wiese
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class icon_system_standard {
+
+    public function render_pix_icon(renderer_base $output, pix_icon $icon) {
+        $data = $icon->export_for_template($output);
+        return $output->render_from_template('core/pix_icon', $data);
+    }
+
+
+}
+
index baea22c..aa13333 100644 (file)
@@ -945,9 +945,9 @@ $functions = array(
         'loginrequired' => false,
         'ajax' => true,
     ),
-    'core_output_load_fontawesome_iconmap' => array(
+    'core_output_load_icon_map' => array(
         'classname' => 'core\output\external',
-        'methodname' => 'load_fontawesome_iconmap',
+        'methodname' => 'load_icon_map',
         'description' => 'Load the mapping of names to icons',
         'type' => 'read',
         'loginrequired' => false,
index a746da3..f347384 100644 (file)
Binary files a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js and b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js differ
index 7468c20..c8e81e4 100644 (file)
Binary files a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js and b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js differ
index 4cf0b1e..0fcb571 100644 (file)
Binary files a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js and b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js differ
index d2a3761..aa33101 100644 (file)
@@ -33,17 +33,17 @@ var MENUTEMPLATE = '' +
             'tabindex="-1" ' +
             'type="button" ' +
             'title="{{title}}">' +
-     //       '<img class="icon" aria-hidden="true" role="presentation" width="16" height="16" ' +
-       //         'style="background-color:{{config.menuColor}};" src="{{config.iconurl}}" />' +
-         //   '<img class="icon" aria-hidden="true" role="presentation" width="16" height="16" ' +
-           //     'src="{{image_url "t/expanded" "moodle"}}"/>' +
+            '<span class="editor_atto_menu_icon"></span>' +
+            '<span class="editor_atto_menu_expand"></span>' +
         '</button>';
 
 var DISABLED = 'disabled',
     HIGHLIGHT = 'highlight',
     LOGNAME = 'moodle-editor_atto-editor-plugin',
     CSS = {
-        EDITORWRAPPER: '.editor_atto_content'
+        EDITORWRAPPER: '.editor_atto_content',
+        MENUICON: '.editor_atto_menu_icon',
+        MENUEXPAND: '.editor_atto_menu_expand'
     };
 
 function EditorPluginButtons() {}
@@ -213,8 +213,9 @@ EditorPluginButtons.prototype = {
                 'tabindex="-1"></button>');
         button.setAttribute('title', title);
         window.require(['core/templates'], function(Templates) {
-            var iconhtml = Templates.renderPix(config.icon, config.iconComponent, title);
-            button.append(iconhtml);
+            Templates.renderPix(config.icon, config.iconComponent, title).then(function(iconhtml) {
+                button.append(iconhtml);
+            });
         });
 
         // Append it to the group.
@@ -385,10 +386,12 @@ EditorPluginButtons.prototype = {
         }));
 
         window.require(['core/templates'], function(Templates) {
-            var iconhtml = Templates.renderPix(config.icon, config.iconComponent, title);
-            button.append(iconhtml);
-            iconhtml = Templates.renderPix('t/expanded', 'core', '');
-            button.append(iconhtml);
+            Templates.renderPix(config.icon, config.iconComponent, title).then(function(iconhtml) {
+                button.one(CSS.MENUICON).append(iconhtml);
+            });
+            Templates.renderPix('t/expanded', 'core', '').then(function(iconhtml) {
+                button.one(CSS.MENUEXPAND).append(iconhtml);
+            });
         });
         
 
index b55bcac..90f0484 100644 (file)
@@ -205,7 +205,6 @@ class external_api {
                 throw new moodle_exception('servicenotavailable', 'webservice');
             }
 
-            // Do not allow access to write or delete webservices as a public user.
             if ($externalfunctioninfo->loginrequired) {
                 if (defined('NO_MOODLE_COOKIES') && NO_MOODLE_COOKIES && !PHPUNIT_TEST) {
                     throw new moodle_exception('servicenotavailable', 'webservice');
@@ -216,6 +215,7 @@ class external_api {
                     require_sesskey();
                 }
             }
+            // Do not allow access to write or delete webservices as a public user.
 
             // Validate params, this also sorts the params properly, we need the correct order in the next part.
             $callable = array($externalfunctioninfo->classname, 'validate_parameters');
index 0b59b82..9ba9341 100644 (file)
@@ -527,6 +527,79 @@ class help_icon implements renderable, templatable {
 }
 
 
+/**
+ * Data structure representing an icon font.
+ *
+ * @copyright 2016 Damyon Wiese
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package core
+ * @category output
+ */
+class pix_icon_font implements templatable {
+
+    /**
+     * @var pix_icon $pixicon The original icon.
+     */
+    private $pixicon = null;
+
+    /**
+     * @var string $key The mapped key.
+     */
+    private $key;
+
+    /**
+     * Constructor
+     *
+     * @param pix_icon $pixicon The original icon
+     */
+    public function __construct(pix_icon $pixicon) {
+        global $PAGE;
+
+        $this->pixicon = $pixicon;
+        $iconsystem = \core\output\icon_system::instance();
+
+        $this->key = $iconsystem->remap_icon_name($pixicon->pix, $pixicon->component);
+        if (empty($this->key)) {
+            $this->key = $pixicon->pix;
+        }
+    }
+
+    /**
+     * Export this data so it can be used as the context for a mustache template.
+     *
+     * @param renderer_base $output Used to do a final render of any components that need to be rendered for export.
+     * @return array
+     */
+    public function export_for_template(renderer_base $output) {
+
+        $pixdata = $this->pixicon->export_for_template($output);
+
+        $title = isset($pixdata['attributes']['title']) ? $pixdata['attributes']['title'] : '';
+        if (empty($title)) {
+            $title = isset($pixdata['attributes']['alt']) ? $pixdata['attributes']['alt'] : '';
+        }
+        $data = array(
+            'extraclasses' => $pixdata['extraclasses'],
+            'title' => $title,
+            'key' => $this->key
+        );
+
+        return $data;
+    }
+}
+
+/**
+ * Data structure representing an icon subtype.
+ *
+ * @copyright 2016 Damyon Wiese
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package core
+ * @category output
+ */
+class pix_icon_fontawesome extends pix_icon_font {
+
+}
+
 /**
  * Data structure representing an icon.
  *
@@ -569,17 +642,12 @@ class pix_icon implements renderable, templatable {
     public function __construct($pix, $alt, $component='moodle', array $attributes = null) {
         global $PAGE;
 
-        // Allow the theme to remap the icon.
-        $this->pix = theme_remap_fontawesome_icon($pix, $component);
-        if (empty($this->pix)) {
-            $this->pix = $pix;
-        }
+        $this->pix = $pix;
         $this->component  = $component;
         $this->attributes = (array)$attributes;
-        $this->fontawesome = strpos($this->pix, 'fa-') === 0;
 
         if (empty($this->attributes['class'])) {
-            $this->attributes['class'] = 'smallicon';
+            $this->attributes['class'] = '';
         }
 
         // If the alt is empty, don't place it in the attributes, otherwise it will override parent alt text.
@@ -630,10 +698,7 @@ class pix_icon implements renderable, templatable {
         }
         $data = array(
             'attributes' => $templatecontext,
-            'extraclasses' => $extraclasses,
-            'fontawesome' => $this->fontawesome,
-            'title' => $title,
-            'pix' => $this->pix,
+            'extraclasses' => $extraclasses
         );
 
         return $data;
index c930556..5195c5f 100644 (file)
@@ -124,797 +124,6 @@ function theme_get_locked_theme_for_device($device) {
     return $CFG->config_php_settings[$themeconfigname];
 }
 
-function theme_get_fontawesome_icon_map() {
-    global $PAGE;
-
-    static $pluginsloaded = false;
-    static $map = [
-        'core:docs' => 'fa-info-circle',
-        'core:help' => 'fa-question-circle',
-        'core:req' => 'fa-exclamation-circle',
-        'core:a/add_file' => 'fa-file-o',
-        'core:a/create_folder' => 'fa-folder-o',
-        'core:a/download_all' => 'fa-download',
-        'core:a/help' => 'fa-question-circle',
-        'core:a/logout' => 'fa-sign-out',
-        'core:a/refresh' => 'fa-refresh',
-        'core:a/search' => 'fa-search',
-        'core:a/setting' => 'fa-cog',
-        'core:a/view_icon_active' => 'fa-th',
-        'core:a/view_list_active' => 'fa-list',
-        'core:a/view_tree_active' => 'fa-folder',
-        'core:b/bookmark-new' => 'fa-bookmark',
-        'core:b/document-edit' => 'fa-pencil',
-        'core:b/document-new' => 'fa-file-o',
-        'core:b/document-properties' => 'fa-info',
-        'core:b/edit-copy' => 'fa-files-o',
-        'core:b/edit-delete' => 'fa-trash',
-        'core:e/abbr' => 'fa-comment',
-        'core:e/absolute' => 'fa-crosshairs',
-        'core:e/accessibility_checker' => 'fa-universal-access',
-        'core:e/acronym' => 'fa-comment',
-        'core:e/advance_hr' => 'fa-arrows-h',
-        'core:e/align_center' => 'fa-align-center',
-        'core:e/align_left' => 'fa-align-left',
-        'core:e/align_right' => 'fa-align-right',
-        'core:e/anchor' => 'fa-chain',
-        'core:e/backward' => 'fa-undo',
-        'core:e/bold' => 'fa-bold',
-        'core:e/bullet_list' => 'fa-list-ul',
-        'core:e/cell_props' => 'fa-info',
-        'core:e/cite' => 'fa-quote-right',
-        'core:e/cleanup_messy_code' => 'fa-eraser',
-        'core:e/clear_formatting' => 'fa-fire',
-        'core:e/copy' => 'fa-clone',
-        'core:e/cut' => 'fa-scissors',
-        'core:e/decrease_indent' => 'fa-outdent',
-        'core:e/delete_col' => 'fa-minus',
-        'core:e/delete_row' => 'fa-minus',
-        'core:e/delete' => 'fa-minus',
-        'core:e/delete_table' => 'fa-minus',
-        'core:e/document_properties' => 'fa-info',
-        'core:e/emoticons' => 'fa-meh-o',
-        'core:e/find_replace' => 'fa-search-plus',
-        'core:e/forward' => 'fa-arrow-right',
-        'core:e/fullpage' => 'fa-arrows-alt',
-        'core:e/fullscreen' => 'fa-arrows-alt',
-        'core:e/help' => 'fa-question-circle',
-        'core:e/increase_indent' => 'fa-indent',
-        'core:e/insert_col_after' => 'fa-columns',
-        'core:e/insert_col_before' => 'fa-columns',
-        'core:e/insert_date' => 'fa-calendar',
-        'core:e/insert_edit_image' => 'fa-picture-o',
-        'core:e/insert_edit_link' => 'fa-link',
-        'core:e/insert_edit_video' => 'fa-video-camera',
-        'core:e/insert_file' => 'fa-file',
-        'core:e/insert_horizontal_ruler' => 'fa-arrows-h',
-        'core:e/insert_nonbreaking_space' => 'fa-square-o',
-        'core:e/insert_page_break' => 'fa-level-down',
-        'core:e/insert_row_after' => 'fa-plus',
-        'core:e/insert_row_before' => 'fa-plus',
-        'core:e/insert' => 'fa-plus',
-        'core:e/insert_time' => 'fa-clock-o',
-        'core:e/italic' => 'fa-italic',
-        'core:e/justify' => 'fa-align-justify',
-        'core:e/layers_over' => 'fa-level-up',
-        'core:e/layers' => 'fa-window-restore',
-        'core:e/layers_under' => 'fa-level-down',
-        'core:e/left_to_right' => 'fa-chevron-right',
-        'core:e/manage_files' => 'fa-files-o',
-        'core:e/math' => 'fa-calculator',
-        'core:e/merge_cells' => 'fa-compress',
-        'core:e/new_document' => 'fa-file-o',
-        'core:e/numbered_list' => 'fa-list-ol',
-        'core:e/page_break' => 'fa-level-down',
-        'core:e/paste' => 'fa-clipboard',
-        'core:e/paste_text' => 'fa-clipboard',
-        'core:e/paste_word' => 'fa-clipboard',
-        'core:e/prevent_autolink' => 'fa-exclamation',
-        'core:e/preview' => 'fa-search-plus',
-        'core:e/print' => 'fa-print',
-        'core:e/question' => 'fa-question',
-        'core:e/redo' => 'fa-repeat',
-        'core:e/remove_link' => 'fa-remove',
-        'core:e/remove_page_break' => 'fa-remove',
-        'core:e/resize' => 'fa-expand',
-        'core:e/restore_draft' => 'fa-undo',
-        'core:e/restore_last_draft' => 'fa-undo',
-        'core:e/right_to_left' => 'fa-chevron-left',
-        'core:e/row_props' => 'fa-info',
-        'core:e/save' => 'fa-floppy-o',
-        'core:e/screenreader_helper' => 'fa-braille',
-        'core:e/search' => 'fa-search',
-        'core:e/select_all' => 'fa-arrows-h',
-        'core:e/show_invisible_characters' => 'fa-eye',
-        'core:e/source_code' => 'fa-code',
-        'core:e/special_character' => 'fa-heart',
-        'core:e/spellcheck' => 'fa-check',
-        'core:e/split_cells' => 'fa-columns',
-        'core:e/strikethrough' => 'fa-strikethrough',
-        'core:e/styleprops' => 'fa-info',
-        'core:e/subscript' => 'fa-subscript',
-        'core:e/superscript' => 'fa-superscript',
-        'core:e/table_props' => 'fa-table',
-        'core:e/table' => 'fa-table',
-        'core:e/template' => 'fa-sticky-note',
-        'core:e/text_color_picker' => 'fa-paint-brush',
-        'core:e/text_color' => 'fa-paint-brush',
-        'core:e/text_highlight_picker' => 'fa-lightbulb-o',
-        'core:e/text_highlight' => 'fa-lightbulb-o',
-        'core:e/tick' => 'fa-check',
-        'core:e/toggle_blockquote' => 'fa-quote-left',
-        'core:e/underline' => 'fa-underline',
-        'core:e/undo' => 'fa-undo',
-        'core:e/visual_aid' => 'fa-universal-access',
-        'core:e/visual_blocks' => 'fa-audio-description',
-        'core:f/archive' => 'fa-file-zip-o',
-        'core:f/archive-24' => 'fa-file-zip-o',
-        'core:f/archive-32' => 'fa-file-zip-o',
-        'core:f/archive-48' => 'fa-file-zip-o',
-        'core:f/archive-64' => 'fa-file-zip-o',
-        'core:f/archive-72' => 'fa-file-zip-o',
-        'core:f/archive-80' => 'fa-file-zip-o',
-        'core:f/archive-96' => 'fa-file-zip-o',
-        'core:f/archive-128' => 'fa-file-zip-o',
-        'core:f/archive-256' => 'fa-file-zip-o',
-        'core:f/audio' => 'fa-file-audio-o',
-        'core:f/audio-24' => 'fa-file-audio-o',
-        'core:f/audio-32' => 'fa-file-audio-o',
-        'core:f/audio-48' => 'fa-file-audio-o',
-        'core:f/audio-64' => 'fa-file-audio-o',
-        'core:f/audio-72' => 'fa-file-audio-o',
-        'core:f/audio-80' => 'fa-file-audio-o',
-        'core:f/audio-96' => 'fa-file-audio-o',
-        'core:f/audio-128' => 'fa-file-audio-o',
-        'core:f/audio-256' => 'fa-file-audio-o',
-        'core:f/avi' => 'fa-file-movie-o',
-        'core:f/avi-24' => 'fa-file-movie-o',
-        'core:f/avi-32' => 'fa-file-movie-o',
-        'core:f/avi-48' => 'fa-file-movie-o',
-        'core:f/avi-64' => 'fa-file-movie-o',
-        'core:f/avi-72' => 'fa-file-movie-o',
-        'core:f/avi-80' => 'fa-file-movie-o',
-        'core:f/avi-96' => 'fa-file-movie-o',
-        'core:f/avi-128' => 'fa-file-movie-o',
-        'core:f/avi-256' => 'fa-file-movie-o',
-        'core:f/base' => 'fa-file-o',
-        'core:f/base-24' => 'fa-file-o',
-        'core:f/base-32' => 'fa-file-o',
-        'core:f/base-48' => 'fa-file-o',
-        'core:f/base-64' => 'fa-file-o',
-        'core:f/base-72' => 'fa-file-o',
-        'core:f/base-80' => 'fa-file-o',
-        'core:f/base-96' => 'fa-file-o',
-        'core:f/base-128' => 'fa-file-o',
-        'core:f/base-256' => 'fa-file-o',
-        'core:f/bmp' => 'fa-file-image-o',
-        'core:f/bmp-24' => 'fa-file-image-o',
-        'core:f/bmp-32' => 'fa-file-image-o',
-        'core:f/bmp-48' => 'fa-file-image-o',
-        'core:f/bmp-64' => 'fa-file-image-o',
-        'core:f/bmp-72' => 'fa-file-image-o',
-        'core:f/bmp-80' => 'fa-file-image-o',
-        'core:f/bmp-96' => 'fa-file-image-o',
-        'core:f/bmp-128' => 'fa-file-image-o',
-        'core:f/bmp-256' => 'fa-file-image-o',
-        'core:f/calc' => 'fa-file-excel-o',
-        'core:f/calc-24' => 'fa-file-excel-o',
-        'core:f/calc-32' => 'fa-file-excel-o',
-        'core:f/calc-48' => 'fa-file-excel-o',
-        'core:f/calc-64' => 'fa-file-excel-o',
-        'core:f/calc-72' => 'fa-file-excel-o',
-        'core:f/calc-80' => 'fa-file-excel-o',
-        'core:f/calc-96' => 'fa-file-excel-o',
-        'core:f/calc-128' => 'fa-file-excel-o',
-        'core:f/calc-256' => 'fa-file-excel-o',
-        'core:f/chart' => 'fa-bar-chart',
-        'core:f/chart-24' => 'fa-bar-chart',
-        'core:f/chart-32' => 'fa-bar-chart',
-        'core:f/chart-48' => 'fa-bar-chart',
-        'core:f/chart-64' => 'fa-bar-chart',
-        'core:f/chart-72' => 'fa-bar-chart',
-        'core:f/chart-80' => 'fa-bar-chart',
-        'core:f/chart-96' => 'fa-bar-chart',
-        'core:f/chart-128' => 'fa-bar-chart',
-        'core:f/chart-256' => 'fa-bar-chart',
-        'core:f/database' => 'fa-database',
-        'core:f/database-24' => 'fa-database',
-        'core:f/database-32' => 'fa-database',
-        'core:f/database-48' => 'fa-database',
-        'core:f/database-64' => 'fa-database',
-        'core:f/database-72' => 'fa-database',
-        'core:f/database-80' => 'fa-database',
-        'core:f/database-96' => 'fa-database',
-        'core:f/database-128' => 'fa-database',
-        'core:f/database-256' => 'fa-database',
-        'core:f/document' => 'fa-file',
-        'core:f/document-24' => 'fa-file',
-        'core:f/document-32' => 'fa-file',
-        'core:f/document-48' => 'fa-file',
-        'core:f/document-64' => 'fa-file',
-        'core:f/document-72' => 'fa-file',
-        'core:f/document-80' => 'fa-file',
-        'core:f/document-96' => 'fa-file',
-        'core:f/document-128' => 'fa-file',
-        'core:f/document-256' => 'fa-file',
-        'core:f/draw' => 'fa-file-image-o',
-        'core:f/draw-24' => 'fa-file-image-o',
-        'core:f/draw-32' => 'fa-file-image-o',
-        'core:f/draw-48' => 'fa-file-image-o',
-        'core:f/draw-64' => 'fa-file-image-o',
-        'core:f/draw-72' => 'fa-file-image-o',
-        'core:f/draw-80' => 'fa-file-image-o',
-        'core:f/draw-96' => 'fa-file-image-o',
-        'core:f/draw-128' => 'fa-file-image-o',
-        'core:f/draw-256' => 'fa-file-image-o',
-        'core:f/eps' => 'fa-file-pdf-o',
-        'core:f/eps-24' => 'fa-file-pdf-o',
-        'core:f/eps-32' => 'fa-file-pdf-o',
-        'core:f/eps-48' => 'fa-file-pdf-o',
-        'core:f/eps-64' => 'fa-file-pdf-o',
-        'core:f/eps-72' => 'fa-file-pdf-o',
-        'core:f/eps-80' => 'fa-file-pdf-o',
-        'core:f/eps-96' => 'fa-file-pdf-o',
-        'core:f/eps-128' => 'fa-file-pdf-o',
-        'core:f/eps-256' => 'fa-file-pdf-o',
-        'core:f/epub' => 'fa-book',
-        'core:f/epub-24' => 'fa-book',
-        'core:f/epub-32' => 'fa-book',
-        'core:f/epub-48' => 'fa-book',
-        'core:f/epub-64' => 'fa-book',
-        'core:f/epub-72' => 'fa-book',
-        'core:f/epub-80' => 'fa-book',
-        'core:f/epub-96' => 'fa-book',
-        'core:f/epub-128' => 'fa-book',
-        'core:f/epub-256' => 'fa-book',
-        'core:f/flash' => 'fa-flash',
-        'core:f/flash-24' => 'fa-flash',
-        'core:f/flash-32' => 'fa-flash',
-        'core:f/flash-48' => 'fa-flash',
-        'core:f/flash-64' => 'fa-flash',
-        'core:f/flash-72' => 'fa-flash',
-        'core:f/flash-80' => 'fa-flash',
-        'core:f/flash-96' => 'fa-flash',
-        'core:f/flash-128' => 'fa-flash',
-        'core:f/flash-256' => 'fa-flash',
-        'core:f/folder' => 'fa-folder',
-        'core:f/folder-24' => 'fa-folder',
-        'core:f/folder-32' => 'fa-folder',
-        'core:f/folder-48' => 'fa-folder',
-        'core:f/folder-64' => 'fa-folder',
-        'core:f/folder-72' => 'fa-folder',
-        'core:f/folder-80' => 'fa-folder',
-        'core:f/folder-96' => 'fa-folder',
-        'core:f/folder-128' => 'fa-folder',
-        'core:f/folder-256' => 'fa-folder',
-        'core:f/folder-open' => 'fa-folder-open',
-        'core:f/folder-open-24' => 'fa-folder-open',
-        'core:f/folder-open-32' => 'fa-folder-open',
-        'core:f/folder-open-48' => 'fa-folder-open',
-        'core:f/folder-open-64' => 'fa-folder-open',
-        'core:f/folder-open-72' => 'fa-folder-open',
-        'core:f/folder-open-80' => 'fa-folder-open',
-        'core:f/folder-open-96' => 'fa-folder-open',
-        'core:f/folder-open-128' => 'fa-folder-open',
-        'core:f/folder-open-256' => 'fa-folder-open',
-        'core:f/gif' => 'fa-file-image-o',
-        'core:f/gif-24' => 'fa-file-image-o',
-        'core:f/gif-32' => 'fa-file-image-o',
-        'core:f/gif-48' => 'fa-file-image-o',
-        'core:f/gif-64' => 'fa-file-image-o',
-        'core:f/gif-72' => 'fa-file-image-o',
-        'core:f/gif-80' => 'fa-file-image-o',
-        'core:f/gif-96' => 'fa-file-image-o',
-        'core:f/gif-128' => 'fa-file-image-o',
-        'core:f/gif-256' => 'fa-file-image-o',
-        'core:f/html' => 'fa-file-code-o',
-        'core:f/html-24' => 'fa-file-code-o',
-        'core:f/html-32' => 'fa-file-code-o',
-        'core:f/html-48' => 'fa-file-code-o',
-        'core:f/html-64' => 'fa-file-code-o',
-        'core:f/html-72' => 'fa-file-code-o',
-        'core:f/html-80' => 'fa-file-code-o',
-        'core:f/html-96' => 'fa-file-code-o',
-        'core:f/html-128' => 'fa-file-code-o',
-        'core:f/html-256' => 'fa-file-code-o',
-        'core:f/image' => 'fa-file-image-o',
-        'core:f/image-24' => 'fa-file-image-o',
-        'core:f/image-32' => 'fa-file-image-o',
-        'core:f/image-48' => 'fa-file-image-o',
-        'core:f/image-64' => 'fa-file-image-o',
-        'core:f/image-72' => 'fa-file-image-o',
-        'core:f/image-80' => 'fa-file-image-o',
-        'core:f/image-96' => 'fa-file-image-o',
-        'core:f/image-128' => 'fa-file-image-o',
-        'core:f/image-256' => 'fa-file-image-o',
-        'core:f/impress' => 'fa-file-powerpoint-o',
-        'core:f/impress-24' => 'fa-file-powerpoint-o',
-        'core:f/impress-32' => 'fa-file-powerpoint-o',
-        'core:f/impress-48' => 'fa-file-powerpoint-o',
-        'core:f/impress-64' => 'fa-file-powerpoint-o',
-        'core:f/impress-72' => 'fa-file-powerpoint-o',
-        'core:f/impress-80' => 'fa-file-powerpoint-o',
-        'core:f/impress-96' => 'fa-file-powerpoint-o',
-        'core:f/impress-128' => 'fa-file-powerpoint-o',
-        'core:f/impress-256' => 'fa-file-powerpoint-o',
-        'core:f/isf' => 'fa-file-image-o',
-        'core:f/isf-24' => 'fa-file-image-o',
-        'core:f/isf-32' => 'fa-file-image-o',
-        'core:f/isf-48' => 'fa-file-image-o',
-        'core:f/isf-64' => 'fa-file-image-o',
-        'core:f/isf-72' => 'fa-file-image-o',
-        'core:f/isf-80' => 'fa-file-image-o',
-        'core:f/isf-96' => 'fa-file-image-o',
-        'core:f/isf-128' => 'fa-file-image-o',
-        'core:f/isf-256' => 'fa-file-image-o',
-        'core:f/jpeg' => 'fa-file-image-o',
-        'core:f/jpeg-24' => 'fa-file-image-o',
-        'core:f/jpeg-32' => 'fa-file-image-o',
-        'core:f/jpeg-48' => 'fa-file-image-o',
-        'core:f/jpeg-64' => 'fa-file-image-o',
-        'core:f/jpeg-72' => 'fa-file-image-o',
-        'core:f/jpeg-80' => 'fa-file-image-o',
-        'core:f/jpeg-96' => 'fa-file-image-o',
-        'core:f/jpeg-128' => 'fa-file-image-o',
-        'core:f/jpeg-256' => 'fa-file-image-o',
-        'core:f/markup' => 'fa-file-code-o',
-        'core:f/markup-24' => 'fa-file-code-o',
-        'core:f/markup-32' => 'fa-file-code-o',
-        'core:f/markup-48' => 'fa-file-code-o',
-        'core:f/markup-64' => 'fa-file-code-o',
-        'core:f/markup-72' => 'fa-file-code-o',
-        'core:f/markup-80' => 'fa-file-code-o',
-        'core:f/markup-96' => 'fa-file-code-o',
-        'core:f/markup-128' => 'fa-file-code-o',
-        'core:f/markup-256' => 'fa-file-code-o',
-        'core:f/math' => 'fa-calculator',
-        'core:f/math-24' => 'fa-calculator',
-        'core:f/math-32' => 'fa-calculator',
-        'core:f/math-48' => 'fa-calculator',
-        'core:f/math-64' => 'fa-calculator',
-        'core:f/math-72' => 'fa-calculator',
-        'core:f/math-80' => 'fa-calculator',
-        'core:f/math-96' => 'fa-calculator',
-        'core:f/math-128' => 'fa-calculator',
-        'core:f/math-256' => 'fa-calculator',
-        'core:f/moodle' => 'fa-graduation-cap',
-        'core:f/moodle-24' => 'fa-graduation-cap',
-        'core:f/moodle-32' => 'fa-graduation-cap',
-        'core:f/moodle-48' => 'fa-graduation-cap',
-        'core:f/moodle-64' => 'fa-graduation-cap',
-        'core:f/moodle-72' => 'fa-graduation-cap',
-        'core:f/moodle-80' => 'fa-graduation-cap',
-        'core:f/moodle-96' => 'fa-graduation-cap',
-        'core:f/moodle-128' => 'fa-graduation-cap',
-        'core:f/moodle-256' => 'fa-graduation-cap',
-        'core:f/mp3' => 'fa-file-audio-o',
-        'core:f/mp3-24' => 'fa-file-audio-o',
-        'core:f/mp3-32' => 'fa-file-audio-o',
-        'core:f/mp3-48' => 'fa-file-audio-o',
-        'core:f/mp3-64' => 'fa-file-audio-o',
-        'core:f/mp3-72' => 'fa-file-audio-o',
-        'core:f/mp3-80' => 'fa-file-audio-o',
-        'core:f/mp3-96' => 'fa-file-audio-o',
-        'core:f/mp3-128' => 'fa-file-audio-o',
-        'core:f/mp3-256' => 'fa-file-audio-o',
-        'core:f/mpeg' => 'fa-file-video-o',
-        'core:f/mpeg-24' => 'fa-file-video-o',
-        'core:f/mpeg-32' => 'fa-file-video-o',
-        'core:f/mpeg-48' => 'fa-file-video-o',
-        'core:f/mpeg-64' => 'fa-file-video-o',
-        'core:f/mpeg-72' => 'fa-file-video-o',
-        'core:f/mpeg-80' => 'fa-file-video-o',
-        'core:f/mpeg-96' => 'fa-file-video-o',
-        'core:f/mpeg-128' => 'fa-file-video-o',
-        'core:f/mpeg-256' => 'fa-file-video-o',
-        'core:f/oth' => 'fa-file-o',
-        'core:f/oth-24' => 'fa-file-o',
-        'core:f/oth-32' => 'fa-file-o',
-        'core:f/oth-48' => 'fa-file-o',
-        'core:f/oth-64' => 'fa-file-o',
-        'core:f/oth-72' => 'fa-file-o',
-        'core:f/oth-80' => 'fa-file-o',
-        'core:f/oth-96' => 'fa-file-o',
-        'core:f/oth-128' => 'fa-file-o',
-        'core:f/oth-256' => 'fa-file-o',
-        'core:f/pdf' => 'fa-file-pdf-o',
-        'core:f/pdf-24' => 'fa-file-pdf-o',
-        'core:f/pdf-32' => 'fa-file-pdf-o',
-        'core:f/pdf-48' => 'fa-file-pdf-o',
-        'core:f/pdf-64' => 'fa-file-pdf-o',
-        'core:f/pdf-72' => 'fa-file-pdf-o',
-        'core:f/pdf-80' => 'fa-file-pdf-o',
-        'core:f/pdf-96' => 'fa-file-pdf-o',
-        'core:f/pdf-128' => 'fa-file-pdf-o',
-        'core:f/pdf-256' => 'fa-file-pdf-o',
-        'core:f/png' => 'fa-file-image-o',
-        'core:f/png-24' => 'fa-file-image-o',
-        'core:f/png-32' => 'fa-file-image-o',
-        'core:f/png-48' => 'fa-file-image-o',
-        'core:f/png-64' => 'fa-file-image-o',
-        'core:f/png-72' => 'fa-file-image-o',
-        'core:f/png-80' => 'fa-file-image-o',
-        'core:f/png-96' => 'fa-file-image-o',
-        'core:f/png-128' => 'fa-file-image-o',
-        'core:f/png-256' => 'fa-file-image-o',
-        'core:f/powerpoint' => 'fa-file-powerpoint-o',
-        'core:f/powerpoint-24' => 'fa-file-powerpoint-o',
-        'core:f/powerpoint-32' => 'fa-file-powerpoint-o',
-        'core:f/powerpoint-48' => 'fa-file-powerpoint-o',
-        'core:f/powerpoint-64' => 'fa-file-powerpoint-o',
-        'core:f/powerpoint-72' => 'fa-file-powerpoint-o',
-        'core:f/powerpoint-80' => 'fa-file-powerpoint-o',
-        'core:f/powerpoint-96' => 'fa-file-powerpoint-o',
-        'core:f/powerpoint-128' => 'fa-file-powerpoint-o',
-        'core:f/powerpoint-256' => 'fa-file-powerpoint-o',
-        'core:f/psd' => 'fa-file-image-o',
-        'core:f/psd-24' => 'fa-file-image-o',
-        'core:f/psd-32' => 'fa-file-image-o',
-        'core:f/psd-48' => 'fa-file-image-o',
-        'core:f/psd-64' => 'fa-file-image-o',
-        'core:f/psd-72' => 'fa-file-image-o',
-        'core:f/psd-80' => 'fa-file-image-o',
-        'core:f/psd-96' => 'fa-file-image-o',
-        'core:f/psd-128' => 'fa-file-image-o',
-        'core:f/psd-256' => 'fa-file-image-o',
-        'core:f/publisher' => 'fa-file-image-o',
-        'core:f/publisher-24' => 'fa-file-image-o',
-        'core:f/publisher-32' => 'fa-file-image-o',
-        'core:f/publisher-48' => 'fa-file-image-o',
-        'core:f/publisher-64' => 'fa-file-image-o',
-        'core:f/publisher-72' => 'fa-file-image-o',
-        'core:f/publisher-80' => 'fa-file-image-o',
-        'core:f/publisher-96' => 'fa-file-image-o',
-        'core:f/publisher-128' => 'fa-file-image-o',
-        'core:f/publisher-256' => 'fa-file-image-o',
-        'core:f/quicktime' => 'fa-file-video-o',
-        'core:f/quicktime-24' => 'fa-file-video-o',
-        'core:f/quicktime-32' => 'fa-file-video-o',
-        'core:f/quicktime-48' => 'fa-file-video-o',
-        'core:f/quicktime-64' => 'fa-file-video-o',
-        'core:f/quicktime-72' => 'fa-file-video-o',
-        'core:f/quicktime-80' => 'fa-file-video-o',
-        'core:f/quicktime-96' => 'fa-file-video-o',
-        'core:f/quicktime-128' => 'fa-file-video-o',
-        'core:f/quicktime-256' => 'fa-file-video-o',
-        'core:f/sourcecode' => 'fa-file-code-o',
-        'core:f/sourcecode-24' => 'fa-file-code-o',
-        'core:f/sourcecode-32' => 'fa-file-code-o',
-        'core:f/sourcecode-48' => 'fa-file-code-o',
-        'core:f/sourcecode-64' => 'fa-file-code-o',
-        'core:f/sourcecode-72' => 'fa-file-code-o',
-        'core:f/sourcecode-80' => 'fa-file-code-o',
-        'core:f/sourcecode-96' => 'fa-file-code-o',
-        'core:f/sourcecode-128' => 'fa-file-code-o',
-        'core:f/sourcecode-256' => 'fa-file-code-o',
-        'core:f/spreadsheet' => 'fa-file-excel-o',
-        'core:f/spreadsheet-24' => 'fa-file-excel-o',
-        'core:f/spreadsheet-32' => 'fa-file-excel-o',
-        'core:f/spreadsheet-48' => 'fa-file-excel-o',
-        'core:f/spreadsheet-64' => 'fa-file-excel-o',
-        'core:f/spreadsheet-72' => 'fa-file-excel-o',
-        'core:f/spreadsheet-80' => 'fa-file-excel-o',
-        'core:f/spreadsheet-96' => 'fa-file-excel-o',
-        'core:f/spreadsheet-128' => 'fa-file-excel-o',
-        'core:f/spreadsheet-256' => 'fa-file-excel-o',
-        'core:f/text' => 'fa-file-text-o',
-        'core:f/text-24' => 'fa-file-text-o',
-        'core:f/text-32' => 'fa-file-text-o',
-        'core:f/text-48' => 'fa-file-text-o',
-        'core:f/text-64' => 'fa-file-text-o',
-        'core:f/text-72' => 'fa-file-text-o',
-        'core:f/text-80' => 'fa-file-text-o',
-        'core:f/text-96' => 'fa-file-text-o',
-        'core:f/text-128' => 'fa-file-text-o',
-        'core:f/text-256' => 'fa-file-text-o',
-        'core:f/tiff' => 'fa-file-image-o',
-        'core:f/tiff-24' => 'fa-file-image-o',
-        'core:f/tiff-32' => 'fa-file-image-o',
-        'core:f/tiff-48' => 'fa-file-image-o',
-        'core:f/tiff-64' => 'fa-file-image-o',
-        'core:f/tiff-72' => 'fa-file-image-o',
-        'core:f/tiff-80' => 'fa-file-image-o',
-        'core:f/tiff-96' => 'fa-file-image-o',
-        'core:f/tiff-128' => 'fa-file-image-o',
-        'core:f/tiff-256' => 'fa-file-image-o',
-        'core:f/unknown' => 'fa-file-o',
-        'core:f/unknown-24' => 'fa-file-o',
-        'core:f/unknown-32' => 'fa-file-o',
-        'core:f/unknown-48' => 'fa-file-o',
-        'core:f/unknown-64' => 'fa-file-o',
-        'core:f/unknown-72' => 'fa-file-o',
-        'core:f/unknown-80' => 'fa-file-o',
-        'core:f/unknown-96' => 'fa-file-o',
-        'core:f/unknown-128' => 'fa-file-o',
-        'core:f/unknown-256' => 'fa-file-o',
-        'core:f/video' => 'fa-file-video-o',
-        'core:f/video-24' => 'fa-file-video-o',
-        'core:f/video-32' => 'fa-file-video-o',
-        'core:f/video-48' => 'fa-file-video-o',
-        'core:f/video-64' => 'fa-file-video-o',
-        'core:f/video-72' => 'fa-file-video-o',
-        'core:f/video-80' => 'fa-file-video-o',
-        'core:f/video-96' => 'fa-file-video-o',
-        'core:f/video-128' => 'fa-file-video-o',
-        'core:f/video-256' => 'fa-file-video-o',
-        'core:f/wav' => 'fa-file-audio-o',
-        'core:f/wav-24' => 'fa-file-audio-o',
-        'core:f/wav-32' => 'fa-file-audio-o',
-        'core:f/wav-48' => 'fa-file-audio-o',
-        'core:f/wav-64' => 'fa-file-audio-o',
-        'core:f/wav-72' => 'fa-file-audio-o',
-        'core:f/wav-80' => 'fa-file-audio-o',
-        'core:f/wav-96' => 'fa-file-audio-o',
-        'core:f/wav-128' => 'fa-file-audio-o',
-        'core:f/wav-256' => 'fa-file-audio-o',
-        'core:f/wmv' => 'fa-file-video-o',
-        'core:f/wmv-24' => 'fa-file-video-o',
-        'core:f/wmv-32' => 'fa-file-video-o',
-        'core:f/wmv-48' => 'fa-file-video-o',
-        'core:f/wmv-64' => 'fa-file-video-o',
-        'core:f/wmv-72' => 'fa-file-video-o',
-        'core:f/wmv-80' => 'fa-file-video-o',
-        'core:f/wmv-96' => 'fa-file-video-o',
-        'core:f/wmv-128' => 'fa-file-video-o',
-        'core:f/wmv-256' => 'fa-file-video-o',
-        'core:f/writer' => 'fa-file-word-o',
-        'core:f/writer-24' => 'fa-file-word-o',
-        'core:f/writer-32' => 'fa-file-word-o',
-        'core:f/writer-48' => 'fa-file-word-o',
-        'core:f/writer-64' => 'fa-file-word-o',
-        'core:f/writer-72' => 'fa-file-word-o',
-        'core:f/writer-80' => 'fa-file-word-o',
-        'core:f/writer-96' => 'fa-file-word-o',
-        'core:f/writer-128' => 'fa-file-word-o',
-        'core:f/writer-256' => 'fa-file-word-o',
-        'theme:fp/add_file' => 'fa-file-o',
-        'theme:fp/alias' => 'fa-link',
-        'theme:fp/check' => 'fa-check',
-        'theme:fp/create_folder' => 'fa-folder',
-        'theme:fp/cross' => 'fa-remove',
-        'theme:fp/download_all' => 'fa-download',
-        'theme:fp/help' => 'fa-question-circle',
-        'theme:fp/link' => 'fa-link',
-        'theme:fp/link_sm' => 'fa-link',
-        'theme:fp/logout' => 'fa-sign-out',
-        'theme:fp/path_folder' => 'fa-folder',
-        'theme:fp/path_folder_rtl' => 'fa-folder',
-        'theme:fp/refresh' => 'fa-refresh',
-        'theme:fp/search' => 'fa-search',
-        'theme:fp/setting' => 'fa-cog',
-        'theme:fp/view_icon_active' => 'fa-th',
-        'theme:fp/view_list_active' => 'fa-list',
-        'theme:fp/view_tree_active' => 'fa-folder',
-        'core:i/assignroles' => 'fa-user-plus',
-        'core:i/backup' => 'fa-file-zip-o',
-        'core:i/badge' => 'fa-shield',
-        'core:i/calc' => 'fa-calculator',
-        'core:i/calendar' => 'fa-calendar',
-        'core:i/caution' => 'fa-exclamation',
-        'core:i/checked' => 'fa-check',
-        'core:i/checkpermissions' => 'fa-unlock-alt',
-        'core:i/cohort' => 'fa-users',
-        'core:i/competencies' => 'fa-check-square-o',
-        'core:i/completion-auto-enabled' => 'fa-check-square',
-        'core:i/completion-auto-fail' => 'fa-square-o',
-        'core:i/completion-auto-n' => 'fa-square-o',
-        'core:i/completion-auto-pass' => 'fa-check-square',
-        'core:i/completion-auto-y' => 'fa-check-square',
-        'core:i/completion-manual-enabled' => 'fa-square-o',
-        'core:i/completion-manual-y' => 'fa-check-square',
-        'core:i/completion-manual-n' => 'fa-minus-square',
-        'core:i/completion-self' => 'fa-user-o',
-        'core:i/lock' => 'fa-lock',
-        'core:i/courseevent' => 'fa-calendar',
-        'core:i/course' => 'fa-globe',
-        'core:i/db' => 'fa-database',
-        'core:i/delete' => 'fa-trash',
-        'core:i/down' => 'fa-arrow-down',
-        'core:i/dragdrop' => 'fa-arrows',
-        'core:i/duration' => 'fa-clock',
-        'core:i/edit' => 'fa-pencil',
-        'core:i/email' => 'fa-envelope',
-        'core:i/enrolmentsuspended' => 'fa-user-circle',
-        'core:i/enrolusers' => 'fa-user-plus',
-        'core:i/expired' => 'fa-exclamation',
-        'core:i/export' => 'fa-level-down',
-        'core:i/files' => 'fa-file',
-        'core:i/filter' => 'fa-filter',
-        'core:i/flagged' => 'fa-flag',
-        'core:i/folder' => 'fa-folder',
-        'core:i/grade_correct' => 'fa-check',
-        'core:i/grade_incorrect' => 'fa-remove',
-        'core:i/grade_partiallycorrect' => 'fa-check-square',
-        'core:i/grades' => 'fa-graduation-cap',
-        'core:i/groupevent' => 'fa-group',
-        'core:i/groupn' => 'fa-user',
-        'core:i/group' => 'fa-users',
-        'core:i/groups' => 'fa-user-circle-o',
-        'core:i/groupv' => 'fa-users',
-        'core:i/hide' => 'fa-eye',
-        'core:i/heirarchylock' => 'fa-lock',
-        'core:i/import' => 'fa-level-up',
-        'core:i/info' => 'fa-info',
-        'core:i/invalid' => 'fa-exclamation',
-        'core:i/item' => 'fa-circle',
-        'core:i/loading' => 'fa-circle-o-notch fa-spin',
-        'core:i/loading_small' => 'fa-circle-o-notch fa-spin',
-        'core:i/lock' => 'fa-lock',
-        'core:i/log' => 'fa-list-alt',
-        'core:i/mahara_host' => 'fa-id-badge',
-        'core:i/manual_item' => 'fa-square-o',
-        'core:i/marked' => 'fa-check-square',
-        'core:i/marker' => 'fa-user-o',
-        'core:i/mean' => 'fa-calculator',
-        'core:i/menu' => 'fa-ellipsis-v',
-        'core:i/mnethost' => 'fa-external-link',
-        'core:i/moodle_host' => 'fa-graduation-cap',
-        'core:i/move_2d' => 'fa-arrows',
-        'core:i/navigationitem' => 'fa-angle-right',
-        'core:i/ns_red_mark' => 'fa-remove',
-        'core:i/new' => 'fa-plus',
-        'core:i/news' => 'fa-newspaper',
-        'core:i/nosubcat' => 'fa-plus-square-o',
-        'core:i/notifications' => 'fa-bell',
-        'core:i/open' => 'fa-folder-open',
-        'core:i/outcomes' => 'fa-tasks',
-        'core:i/payment' => 'fa-money',
-        'core:i/permissionlock' => 'fa-lock',
-        'core:i/permissions' => 'fa-pencil-square-o',
-        'core:i/persona_sign_in_black' => 'fa-male',
-        'core:i/portfolio' => 'fa-id-badge',
-        'core:i/preview' => 'fa-search-plus',
-        'core:i/progressbar' => 'fa-spinner fa-spin',
-        'core:i/publish' => 'fa-share',
-        'core:i/questions' => 'fa-question',
-        'core:i/reload' => 'fa-refresh',
-        'core:i/report' => 'fa-area-chart',
-        'core:i/repository' => 'fa-hdd-o',
-        'core:i/restore' => 'fa-level-up',
-        'core:i/return' => 'fa-arrow-left',
-        'core:i/risk_config' => 'fa-cog',
-        'core:i/risk_managetrust' => 'fa-exclamation-triangle',
-        'core:i/risk_personal' => 'fa-user',
-        'core:i/risk_spam' => 'fa-trash',
-        'core:i/risk_xss' => 'fa-exchange',
-        'core:i/role' => 'fa-user-md',
-        'core:i/rss' => 'fa-rss',
-        'core:i/rsssitelogo' => 'fa-rss',
-        'core:i/scales' => 'fa-balance-scale',
-        'core:i/scheduled' => 'fa-calendar-check-o',
-        'core:i/search' => 'fa-search',
-        'core:i/settings' => 'fa-cogs',
-        'core:i/show' => 'fa-eye-slash',
-        'core:i/siteevent' => 'fa-share-alt',
-        'core:i/starrating' => 'fa-star',
-        'core:i/stats' => 'fa-line-chart',
-        'core:i/switch' => 'fa-exchange',
-        'core:i/switchrole' => 'fa-user-secret',
-        'core:i/twoway' => 'fa-arrows-h',
-        'core:i/unchecked' => 'fa-square-o',
-        'core:i/unflagged' => 'fa-flag-o',
-        'core:i/unlock' => 'fa-unlock',
-        'core:i/up' => 'fa-arrow-up',
-        'core:i/userevent' => 'fa-user',
-        'core:i/user' => 'fa-user',
-        'core:i/users' => 'fa-users',
-        'core:i/valid' => 'fa-check-square-o',
-        'core:i/warning' => 'fa-exclamation',
-        'core:i/withsubcat' => 'fa-plus-square',
-        'core:m/USD' => 'fa-usd',
-        'core:t/addcontact' => 'fa-address-card',
-        'core:t/add' => 'fa-plus',
-        'core:t/approve' => 'fa-thumbs-up',
-        'core:t/assignroles' => 'fa-user-circle',
-        'core:t/award' => 'fa-trophy',
-        'core:t/backpack' => 'fa-shopping-bag',
-        'core:t/backup' => 'fa-arrow-circle-down',
-        'core:t/block' => 'fa-commenting-o',
-        'core:t/block_to_dock_rtl' => 'fa-chevron-right',
-        'core:t/block_to_dock' => 'fa-chevron-left',
-        'core:t/calc_off' => 'fa-times',
-        'core:t/calc' => 'fa-calculator',
-        'core:t/check' => 'fa-check',
-        'core:t/cohort' => 'fa-users',
-        'core:t/collapsed_empty_rtl' => 'fa-plus-square-o',
-        'core:t/collapsed_empty' => 'fa-plus-square-o',
-        'core:t/collapsed_rtl' => 'fa-plus-square',
-        'core:t/collapsed' => 'fa-plus-square',
-        'core:t/contextmenu' => 'fa-cog',
-        'core:t/copy' => 'fa-copy',
-        'core:t/delete' => 'fa-trash',
-        'core:t/dockclose' => 'fa-window-close',
-        'core:t/dock_to_block_rtl' => 'fa-chevron-right',
-        'core:t/dock_to_block' => 'fa-chevron-left',
-        'core:t/download' => 'fa-download',
-        'core:t/down' => 'fa-arrow-down',
-        'core:t/dropdown' => 'fa-cog',
-        'core:t/editinline' => 'fa-pencil',
-        'core:t/edit_menu' => 'fa-cog',
-        'core:t/editstring' => 'fa-pencil',
-        'core:t/edit' => 'fa-cog',
-        'core:t/emailno' => 'fa-envelope-o',
-        'core:t/email' => 'fa-envelope',
-        'core:t/enrolusers' => 'fa-user-plus',
-        'core:t/expanded' => 'fa-caret-down',
-        'core:t/go' => 'fa-arrow-right',
-        'core:t/grades' => 'fa-graduation-cap',
-        'core:t/groupn' => 'fa-users',
-        'core:t/groups' => 'fa-users',
-        'core:t/groupv' => 'fa-users',
-        'core:t/hide' => 'fa-eye',
-        'core:t/left' => 'fa-arrow-left',
-        'core:t/less' => 'fa-caret-up',
-        'core:t/locked' => 'fa-lock',
-        'core:t/lock' => 'fa-lock',
-        'core:t/locktime' => 'fa-lock',
-        'core:t/markasread' => 'fa-check',
-        'core:t/messages' => 'fa-comments',
-        'core:t/message' => 'fa-comment',
-        'core:t/more' => 'fa-caret-down',
-        'core:t/move' => 'fa-arrows',
-        'core:t/passwordunmask-edit' => 'fa-pencil',
-        'core:t/passwordunmask-reveal' => 'fa-eye',
-        'core:t/portfolioadd' => 'fa-plus',
-        'core:t/preferences' => 'fa-wrench',
-        'core:t/preview' => 'fa-search-plus',
-        'core:t/print' => 'fa-print',
-        'core:t/removecontact' => 'fa-user-times',
-        'core:t/reset' => 'fa-repeat',
-        'core:t/restore' => 'fa-arrow-circle-up',
-        'core:t/right' => 'fa-arrow-right',
-        'core:t/show' => 'fa-eye-slash',
-        'core:t/sort_asc' => 'fa-sort-asc',
-        'core:t/sort_desc' => 'fa-sort-desc',
-        'core:t/sort' => 'fa-sort',
-        'core:t/stop' => 'fa-stop',
-        'core:t/switch_minus' => 'fa-minus',
-        'core:t/switch_plus' => 'fa-plus',
-        'core:t/switch_whole' => 'fa-square-o',
-        'core:t/unblock' => 'fa-commenting',
-        'core:t/unlocked' => 'fa-unlock-alt',
-        'core:t/unlock' => 'fa-unlock',
-        'core:t/up' => 'fa-arrow-up',
-        'core:t/user' => 'fa-user',
-        'core:t/viewdetails' => 'fa-list',
-    ];
-
-    if (empty($PAGE->theme->fontawesome)) {
-        return [];
-    }
-
-    if (!$pluginsloaded) {
-        if ($pluginsfunction = get_plugins_with_function('get_fontawesome_icon_map')) {
-            foreach ($pluginsfunction as $plugintype => $plugins) {
-                foreach ($plugins as $pluginfunction) {
-                    $pluginmap = $pluginfunction();
-                    $map += $pluginmap;
-                }
-            }
-        }
-        
-        $pluginsloaded = true;
-    }
-    return $map;
-}
-
-/**
- * Remap all the old core icons to font-awesome icons.
- */
-function theme_remap_fontawesome_icon($iconname, $component) {
-    $map = theme_get_fontawesome_icon_map();
-
-    if ($component == null) {
-        $component = 'core';
-    } else if ($component != 'theme') {
-        $component = core_component::normalize_componentname($component);
-    }
-
-    if (isset($map[$component . ':' . $iconname])) {
-        return $map[$component . ':' . $iconname];
-    }
-    return false;
-}
 
 /**
  * This class represents the configuration variables of a Moodle theme.
@@ -1349,7 +558,7 @@ class theme_config {
             'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'uarrow', 'darrow',
             'hidefromselector', 'doctype', 'yuicssmodules', 'blockrtlmanipulations',
             'lessfile', 'extralesscallback', 'lessvariablescallback', 'blockrendermethod',
-            'scss', 'extrascsscallback', 'prescsscallback', 'csstreepostprocessor', 'addblockposition', 'fontawesome');
+            'scss', 'extrascsscallback', 'prescsscallback', 'csstreepostprocessor', 'addblockposition', 'iconsystem');
 
         foreach ($config as $key=>$value) {
             if (in_array($key, $configurable)) {
@@ -2030,6 +1239,26 @@ class theme_config {
         return $compiled;
     }
 
+    /**
+     * Get the icon system to use.
+     *
+     * @return string
+     */
+    public function get_icon_system() {
+
+        // Getting all the candidate functions.
+        $system = false;
+        if (isset($this->iconsystem) && \core\output\icon_system::is_valid_system($this->iconsystem)) {
+            return $this->iconsystem;
+        }
+        foreach ($this->parent_configs as $parent_config) {
+            if (isset($parent_config->iconsystem) && \core\output\icon_system::is_valid_system($parent_config->iconsystem)) {
+                return $parent_config->iconsystem;
+            }
+        }
+        return 'standard';
+    }
+
     /**
      * Return extra LESS variables to use when compiling.
      *
index 5495f90..179f80c 100644 (file)
@@ -253,6 +253,11 @@ class renderer_base {
         return $classes;
     }
 
+    public function pix_url($imagename, $component = 'moodle') {
+        debugging('pix_url is deprecated. Use image_url for images and pix_icon for icons.');
+        return $this->page->theme->image_url($imagename, $component);
+    }
+
     /**
      * Return the moodle_url for an image.
      *
@@ -271,14 +276,14 @@ class renderer_base {
      *                    overridden via theme/mytheme/pix_core/
      * 3/ plugin images - stored in mod/mymodule/pix,
      *                    overridden via theme/mytheme/pix_plugins/mod/mymodule/,
-     *                    example: pix_url('comment', 'mod_glossary')
+     *                    example: image_url('comment', 'mod_glossary')
      *
      * @param string $imagename the pathname of the image
      * @param string $component full plugin name (aka component) or 'theme'
      * @return moodle_url
      */
-    public function pix_url($imagename, $component = 'moodle') {
-        return $this->page->theme->pix_url($imagename, $component);
+    public function image_url($imagename, $component = 'moodle') {
+        return $this->page->theme->image_url($imagename, $component);
     }
 
     /**
@@ -2047,8 +2052,10 @@ class core_renderer extends renderer_base {
      * @return string HTML fragment
      */
     protected function render_pix_icon(pix_icon $icon) {
-        $data = $icon->export_for_template($this);
-        return $this->render_from_template('core/pix_icon', $data);
+        global $PAGE;
+
+        $system = \core\output\icon_system::instance();
+        return $system->render_pix_icon($this, $icon);
     }
 
     /**
index 522f7e7..3569d34 100644 (file)
@@ -320,6 +320,7 @@ class page_requirements_manager {
                 'themerev'            => theme_get_revision(),
                 'slasharguments'      => (int)(!empty($CFG->slasharguments)),
                 'theme'               => $page->theme->name,
+                'iconsystem'          => $page->theme->get_icon_system(),
                 'jsrev'               => $this->get_jsrev(),
                 'admin'               => $CFG->admin,
                 'svgicons'            => $page->theme->use_svg_icons(),
index adc7232..62f92a3 100644 (file)
@@ -28,7 +28,8 @@
     * none
 
     Context variables required for this template:
-    * attributes Array of name / value pairs.
+    * attributes Array of name / value pairs. Includes title, alt, src.
+    * extraclasses List of extra classes to append.
 
     Example context (json):
     {
@@ -40,9 +41,4 @@
     }
 
 }}
-{{#fontawesome}}
-<i class="icon fa {{pix}} fa-fw {{extraclasses}}" aria-hidden="true" title="{{title}}"></i><span class="sr-only">{{title}}</span>
-{{/fontawesome}}
-{{^fontawesome}}
 <img class="icon {{extraclasses}}" {{#attributes}}{{name}}="{{value}}" {{/attributes}}/>
-{{/fontawesome}}
diff --git a/lib/templates/pix_icon_fontawesome.mustache b/lib/templates/pix_icon_fontawesome.mustache
new file mode 100644 (file)
index 0000000..096127f
--- /dev/null
@@ -0,0 +1,43 @@
+{{!
+    This file is part of Moodle - http://moodle.org/
+
+    Moodle is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    Moodle is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+}}
+{{!
+    @template core/pix_icon_fontawesome
+
+    Moodle pix_icon template.
+
+    The purpose of this template is to render a pix_icon.
+
+    Classes required for JS:
+    * none
+
+    Data attributes required for JS:
+    * none
+
+    Context variables required for this template:
+    * pix
+    * title
+    * extraclasses
+
+    Example context (json):
+    {
+        "key": "fa-meh-o",
+        "title": "Meh",
+        "extraclasses": "fa-spin"
+    }
+
+}}
+<i class="icon fa {{key}} fa-fw {{extraclasses}}" aria-hidden="true" title="{{title}}"></i><span class="sr-only">{{title}}</span>
index aba5306..8a864e4 100644 (file)
Binary files a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js and b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js differ
index 080e6ab..d70fe16 100644 (file)
Binary files a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js and b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js differ
index aba5306..8a864e4 100644 (file)
Binary files a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop.js and b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop.js differ
index 8f85a05..cf17df5 100644 (file)
@@ -176,12 +176,14 @@ Y.extend(DRAGDROP, Y.Base, {
         dragelement.addClass(MOVEICON.cssclass);
 
         window.require(['core/templates'], function(Templates) {
-            var dragicon = Y.Node.create(Templates.renderPix('i/move_2d', 'core'));
-            dragicon.addClass('moodle-core-dragdrop-draghandle').setStyle('cursor', 'move');
-            if (typeof iconclass != 'undefined') {
-                dragicon.addClass(iconclass);
-            }
-            dragelement.appendChild(dragicon);
+            Templates.renderPix('i/move_2d', 'core').then(function(html) {
+                var dragicon = Y.Node.create(html);
+                dragicon.addClass('moodle-core-dragdrop-draghandle').setStyle('cursor', 'move');
+                if (typeof iconclass != 'undefined') {
+                    dragicon.addClass(iconclass);
+                }
+                dragelement.appendChild(dragicon);
+            });
         }.bind(this));
 
         return dragelement;
index 0e94a07..ada3c09 100644 (file)
@@ -458,16 +458,6 @@ class core_renderer extends \core_renderer {
         return $this->render_from_template('core/paging_bar', $pagingbar->export_for_template($this));
     }
 
-    /**
-     * Renders a url select.
-     *
-     * @param url_select $select The object.
-     * @return string HTML
-     */
-    protected function render_url_select(url_select $select) {
-        return $this->render_from_template('core/url_select', $select->export_for_template($this));
-    }
-
     /**
      * Renders the login form.
      *
index 039a295..c1e32df 100644 (file)
@@ -153,4 +153,4 @@ $THEME->yuicssmodules = array();
 $THEME->rendererfactory = 'theme_overridden_renderer_factory';
 $THEME->requiredblocks = '';
 $THEME->addblockposition = BLOCK_ADDBLOCK_POSITION_FLATNAV;
-$THEME->fontawesome = true;
+$THEME->iconsystem = 'fontawesome';
index 6de5f6a..18d0f31 100644 (file)
@@ -53,6 +53,10 @@ if (!$font) {
     font_not_found();
 }
 
+if ($to = strpos($font, '?')) {
+    $font = substr($font, 0, $to);
+}
+
 if (empty($component) or $component === 'moodle' or $component === 'core') {
     $component = 'core';
 }