| 1 | efrain | 1 | <?php
 | 
        
           |  |  | 2 | // This file is part of Moodle - http://moodle.org/
 | 
        
           |  |  | 3 | //
 | 
        
           |  |  | 4 | // Moodle is free software: you can redistribute it and/or modify
 | 
        
           |  |  | 5 | // it under the terms of the GNU General Public License as published by
 | 
        
           |  |  | 6 | // the Free Software Foundation, either version 3 of the License, or
 | 
        
           |  |  | 7 | // (at your option) any later version.
 | 
        
           |  |  | 8 | //
 | 
        
           |  |  | 9 | // Moodle is distributed in the hope that it will be useful,
 | 
        
           |  |  | 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
        
           |  |  | 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
        
           |  |  | 12 | // GNU General Public License for more details.
 | 
        
           |  |  | 13 | //
 | 
        
           |  |  | 14 | // You should have received a copy of the GNU General Public License
 | 
        
           |  |  | 15 | // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 | 
        
           |  |  | 16 |   | 
        
           |  |  | 17 | namespace core\output;
 | 
        
           |  |  | 18 |   | 
        
           |  |  | 19 | /**
 | 
        
           |  |  | 20 |  * Class allowing different systems for mapping and rendering icons.
 | 
        
           |  |  | 21 |  *
 | 
        
           |  |  | 22 |  * Possible icon styles are:
 | 
        
           |  |  | 23 |  *   1. standard - image tags are generated which point to pix icons stored in a plugin pix folder.
 | 
        
           |  |  | 24 |  *   2. fontawesome - font awesome markup is generated with the name of the icon mapped from the moodle icon name.
 | 
        
           |  |  | 25 |  *   3. inline - inline tags are used for svg and png so no separate page requests are made (at the expense of page size).
 | 
        
           |  |  | 26 |  *
 | 
        
           |  |  | 27 |  * @package    core
 | 
        
           |  |  | 28 |  * @category   output
 | 
        
           |  |  | 29 |  * @copyright  2016 Damyon Wiese
 | 
        
           |  |  | 30 |  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 | 
        
           |  |  | 31 |  */
 | 
        
           |  |  | 32 | class icon_system_fontawesome extends icon_system_font {
 | 
        
           |  |  | 33 |     /**
 | 
        
           |  |  | 34 |      * @var array $map Cached map of moodle icon names to font awesome icon names.
 | 
        
           |  |  | 35 |      */
 | 
        
           |  |  | 36 |     private $map = [];
 | 
        
           |  |  | 37 |   | 
        
           | 1441 | ariadna | 38 |     /**
 | 
        
           |  |  | 39 |      * @var array $families List of Font Awesome families.
 | 
        
           |  |  | 40 |      */
 | 
        
           |  |  | 41 |     private $families = [
 | 
        
           |  |  | 42 |         'fa-brands',
 | 
        
           |  |  | 43 |         'fa-solid',
 | 
        
           |  |  | 44 |         'fa-regular',
 | 
        
           |  |  | 45 |         'fa-light',
 | 
        
           |  |  | 46 |         'fa-thin',
 | 
        
           |  |  | 47 |         'fa-duotone',
 | 
        
           |  |  | 48 |         'fa-sharp',
 | 
        
           |  |  | 49 |     ];
 | 
        
           |  |  | 50 |   | 
        
           | 1 | efrain | 51 |     public function get_core_icon_map() {
 | 
        
           |  |  | 52 |         return [
 | 
        
           | 1441 | ariadna | 53 |             'core:docs' => 'fa-circle-info',
 | 
        
           | 1 | efrain | 54 |             'core:book' => 'fa-book',
 | 
        
           | 1441 | ariadna | 55 |             'core:help' => 'fa-circle-question text-info',
 | 
        
           |  |  | 56 |             'core:req' => 'fa-circle-exclamation text-danger',
 | 
        
           |  |  | 57 |             'core:a/add_file' => 'fa-circle-plus',
 | 
        
           |  |  | 58 |             'core:a/create_folder' => 'fa-folder-plus',
 | 
        
           | 1 | efrain | 59 |             'core:a/download_all' => 'fa-download',
 | 
        
           | 1441 | ariadna | 60 |             'core:a/help' => 'fa-circle-question text-info',
 | 
        
           |  |  | 61 |             'core:a/logout' => 'fa-arrow-right-to-bracket',
 | 
        
           |  |  | 62 |             'core:a/refresh' => 'fa-arrows-rotate',
 | 
        
           |  |  | 63 |             'core:a/search' => 'fa-magnifying-glass',
 | 
        
           |  |  | 64 |             'core:a/setting' => 'fa-gear',
 | 
        
           |  |  | 65 |             'core:a/view_icon_active' => 'fa-border-all',
 | 
        
           | 1 | efrain | 66 |             'core:a/view_list_active' => 'fa-list',
 | 
        
           | 1441 | ariadna | 67 |             'core:a/view_tree_active' => 'fa-folder-tree',
 | 
        
           |  |  | 68 |             'core:b/bookmark-new' => 'fa-regular fa-bookmark',
 | 
        
           |  |  | 69 |             'core:b/document-edit' => 'fa-pen',
 | 
        
           |  |  | 70 |             'core:b/document-new' => 'fa-file-circle-plus',
 | 
        
           |  |  | 71 |             'core:b/document-properties' => 'fa-wrench',
 | 
        
           |  |  | 72 |             'core:b/edit-copy' => 'fa-pen',
 | 
        
           |  |  | 73 |             'core:b/edit-delete' => 'fa-trash-can',
 | 
        
           |  |  | 74 |             'core:e/abbr' => 'fa-regular fa-message',
 | 
        
           | 1 | efrain | 75 |             'core:e/absolute' => 'fa-crosshairs',
 | 
        
           |  |  | 76 |             'core:e/accessibility_checker' => 'fa-universal-access',
 | 
        
           | 1441 | ariadna | 77 |             'core:e/acronym' => 'fa-regular fa-comment',
 | 
        
           |  |  | 78 |             'core:e/advance_hr' => 'fa-arrows-left-right',
 | 
        
           | 1 | efrain | 79 |             'core:e/align_center' => 'fa-align-center',
 | 
        
           |  |  | 80 |             'core:e/align_left' => 'fa-align-left',
 | 
        
           |  |  | 81 |             'core:e/align_right' => 'fa-align-right',
 | 
        
           | 1441 | ariadna | 82 |             'core:e/anchor' => 'fa-anchor',
 | 
        
           |  |  | 83 |             'core:e/backward' => 'fa-arrow-left',
 | 
        
           | 1 | efrain | 84 |             'core:e/bold' => 'fa-bold',
 | 
        
           |  |  | 85 |             'core:e/bullet_list' => 'fa-list-ul',
 | 
        
           | 1441 | ariadna | 86 |             'core:e/cancel' => 'fa-xmark',
 | 
        
           |  |  | 87 |             'core:e/cancel_solid_circle' => 'fa-circle-xmark',
 | 
        
           | 1 | efrain | 88 |             'core:e/cell_props' => 'fa-info',
 | 
        
           |  |  | 89 |             'core:e/cite' => 'fa-quote-right',
 | 
        
           | 1441 | ariadna | 90 |             'core:e/cleanup_messy_code' => 'fa-delete-left',
 | 
        
           |  |  | 91 |             'core:e/clear_formatting' => 'fa-eraser',
 | 
        
           |  |  | 92 |             'core:e/copy' => 'fa-regular fa-clone',
 | 
        
           | 1 | efrain | 93 |             'core:e/cut' => 'fa-scissors',
 | 
        
           |  |  | 94 |             'core:e/decrease_indent' => 'fa-outdent',
 | 
        
           |  |  | 95 |             'core:e/delete_col' => 'fa-minus',
 | 
        
           |  |  | 96 |             'core:e/delete_row' => 'fa-minus',
 | 
        
           | 1441 | ariadna | 97 |             'core:e/delete' => 'fa-trash-can',
 | 
        
           |  |  | 98 |             'core:e/delete_table' => 'fa-trash-can',
 | 
        
           |  |  | 99 |             'core:e/document_properties' => 'fa-wrench',
 | 
        
           |  |  | 100 |             'core:e/emoticons' => 'fa-regular fa-face-smile',
 | 
        
           |  |  | 101 |             'core:e/find_replace' => 'fa-magnifying-glass-plus',
 | 
        
           |  |  | 102 |             'core:e/file-text' => 'fa-regular fa-file-text',
 | 
        
           | 1 | efrain | 103 |             'core:e/forward' => 'fa-arrow-right',
 | 
        
           | 1441 | ariadna | 104 |             'core:e/fullpage' => 'fa-maximize',
 | 
        
           |  |  | 105 |             'core:e/fullscreen' => 'fa-solid fa-expand',
 | 
        
           |  |  | 106 |             'core:e/help' => 'fa-circle-question',
 | 
        
           | 1 | efrain | 107 |             'core:e/increase_indent' => 'fa-indent',
 | 
        
           | 1441 | ariadna | 108 |             'core:e/insert_date' => 'fa-regular fa-calendar-plus',
 | 
        
           |  |  | 109 |             'core:e/insert_edit_image' => 'fa-regular fa-image',
 | 
        
           | 1 | efrain | 110 |             'core:e/insert_edit_link' => 'fa-link',
 | 
        
           | 1441 | ariadna | 111 |             'core:e/insert_edit_video' => 'fa-regular fa-file-video',
 | 
        
           |  |  | 112 |             'core:e/insert_file' => 'fa-regular fa-file',
 | 
        
           |  |  | 113 |             'core:e/insert_horizontal_ruler' => 'fa-ruler-horizontal',
 | 
        
           |  |  | 114 |             'core:e/insert_nonbreaking_space' => 'fa-regular fa-square',
 | 
        
           |  |  | 115 |             'core:e/insert_page_break' => 'fa-plus',
 | 
        
           | 1 | efrain | 116 |             'core:e/insert_row_after' => 'fa-plus',
 | 
        
           |  |  | 117 |             'core:e/insert_row_before' => 'fa-plus',
 | 
        
           |  |  | 118 |             'core:e/insert' => 'fa-plus',
 | 
        
           | 1441 | ariadna | 119 |             'core:e/insert_time' => 'fa-regular fa-clock',
 | 
        
           | 1 | efrain | 120 |             'core:e/italic' => 'fa-italic',
 | 
        
           |  |  | 121 |             'core:e/justify' => 'fa-align-justify',
 | 
        
           | 1441 | ariadna | 122 |             'core:e/layers_over' => 'fa-turn-up',
 | 
        
           |  |  | 123 |             'core:e/layers' => 'fa-layer-group',
 | 
        
           |  |  | 124 |             'core:e/layers_under' => 'fa-turn-down',
 | 
        
           |  |  | 125 |             'core:e/left_to_right' => 'fa-angles-right',
 | 
        
           |  |  | 126 |             'core:e/manage_files' => 'fa-laptop-file',
 | 
        
           |  |  | 127 |             'core:e/math' => 'fa-square-root-variable',
 | 
        
           |  |  | 128 |             'core:e/merge_cells' => 'fa-arrows-to-circle',
 | 
        
           |  |  | 129 |             'core:e/new_document' => 'fa-file-circle-plus',
 | 
        
           | 1 | efrain | 130 |             'core:e/numbered_list' => 'fa-list-ol',
 | 
        
           | 1441 | ariadna | 131 |             'core:e/page_break' => 'fa-arrows-left-right-to-line',
 | 
        
           |  |  | 132 |             'core:e/paste' => 'fa-paste',
 | 
        
           |  |  | 133 |             'core:e/paste_text' => 'fa-paste',
 | 
        
           |  |  | 134 |             'core:e/paste_word' => 'fa-paste',
 | 
        
           | 1 | efrain | 135 |             'core:e/prevent_autolink' => 'fa-exclamation',
 | 
        
           | 1441 | ariadna | 136 |             'core:e/preview' => 'fa-magnifying-glass-plus',
 | 
        
           | 1 | efrain | 137 |             'core:e/print' => 'fa-print',
 | 
        
           |  |  | 138 |             'core:e/question' => 'fa-question',
 | 
        
           | 1441 | ariadna | 139 |             'core:e/redo' => 'fa-arrow-rotate-right',
 | 
        
           |  |  | 140 |             'core:e/remove_link' => 'fa-link-slash',
 | 
        
           |  |  | 141 |             'core:e/remove_page_break' => 'fa-xmark',
 | 
        
           |  |  | 142 |             'core:e/resize' => 'fa-up-right-and-down-left-from-center',
 | 
        
           |  |  | 143 |             'core:e/restore_draft' => 'fa-trash-can-arrow-up',
 | 
        
           |  |  | 144 |             'core:e/restore_last_draft' => 'fa-clock-rotate-left',
 | 
        
           |  |  | 145 |             'core:e/right_to_left' => 'fa-angles-left',
 | 
        
           | 1 | efrain | 146 |             'core:e/row_props' => 'fa-info',
 | 
        
           | 1441 | ariadna | 147 |             'core:e/save' => 'fa-regular fa-floppy-disk',
 | 
        
           |  |  | 148 |             'core:e/screenreader_helper' => 'fa-ear-listen',
 | 
        
           |  |  | 149 |             'core:e/search' => 'fa-magnifying-glass',
 | 
        
           |  |  | 150 |             'core:e/select_all' => 'fa-square-check',
 | 
        
           |  |  | 151 |             'core:e/show_invisible_characters' => 'fa-solid fa-eye',
 | 
        
           | 1 | efrain | 152 |             'core:e/source_code' => 'fa-code',
 | 
        
           | 1441 | ariadna | 153 |             'core:e/special_character' => 'fa-pen-to-square',
 | 
        
           |  |  | 154 |             'core:e/spellcheck' => 'fa-spell-check',
 | 
        
           | 1 | efrain | 155 |             'core:e/strikethrough' => 'fa-strikethrough',
 | 
        
           |  |  | 156 |             'core:e/styleparagraph' => 'fa-font',
 | 
        
           |  |  | 157 |             'core:e/subscript' => 'fa-subscript',
 | 
        
           |  |  | 158 |             'core:e/superscript' => 'fa-superscript',
 | 
        
           |  |  | 159 |             'core:e/table_props' => 'fa-table',
 | 
        
           |  |  | 160 |             'core:e/table' => 'fa-table',
 | 
        
           | 1441 | ariadna | 161 |             'core:e/template' => 'fa-file-invoice',
 | 
        
           |  |  | 162 |             'core:e/text_color_picker' => 'fa-eye-dropper',
 | 
        
           |  |  | 163 |             'core:e/text_highlight_picker' => 'fa-solid fa-highlighter',
 | 
        
           |  |  | 164 |             'core:e/text_highlight' => 'fa-solid fa-highlighter',
 | 
        
           | 1 | efrain | 165 |             'core:e/tick' => 'fa-check',
 | 
        
           |  |  | 166 |             'core:e/toggle_blockquote' => 'fa-quote-left',
 | 
        
           |  |  | 167 |             'core:e/underline' => 'fa-underline',
 | 
        
           | 1441 | ariadna | 168 |             'core:e/undo' => 'fa-rotate-left',
 | 
        
           | 1 | efrain | 169 |             'core:e/visual_aid' => 'fa-universal-access',
 | 
        
           |  |  | 170 |             'core:e/visual_blocks' => 'fa-audio-description',
 | 
        
           | 1441 | ariadna | 171 |             'theme:fp/add_file' => 'fa-file-circle-plus',
 | 
        
           | 1 | efrain | 172 |             'theme:fp/alias' => 'fa-share',
 | 
        
           |  |  | 173 |             'theme:fp/alias_sm' => 'fa-share',
 | 
        
           |  |  | 174 |             'theme:fp/check' => 'fa-check',
 | 
        
           | 1441 | ariadna | 175 |             'theme:fp/create_folder' => 'fa-folder-plus',
 | 
        
           |  |  | 176 |             'theme:fp/cross' => 'fa-xmark',
 | 
        
           | 1 | efrain | 177 |             'theme:fp/download_all' => 'fa-download',
 | 
        
           |  |  | 178 |             'theme:fp/help' => 'fa-question-circle',
 | 
        
           |  |  | 179 |             'theme:fp/link' => 'fa-link',
 | 
        
           |  |  | 180 |             'theme:fp/link_sm' => 'fa-link',
 | 
        
           | 1441 | ariadna | 181 |             'theme:fp/logout' => 'fa-arrow-right-from-bracket',
 | 
        
           | 1 | efrain | 182 |             'theme:fp/path_folder' => 'fa-folder',
 | 
        
           |  |  | 183 |             'theme:fp/path_folder_rtl' => 'fa-folder',
 | 
        
           | 1441 | ariadna | 184 |             'theme:fp/refresh' => 'fa-arrows-rotate',
 | 
        
           |  |  | 185 |             'theme:fp/search' => 'fa-magnifying-glass',
 | 
        
           |  |  | 186 |             'theme:fp/setting' => 'fa-gear',
 | 
        
           |  |  | 187 |             'theme:fp/view_icon_active' => 'fa-border-all',
 | 
        
           | 1 | efrain | 188 |             'theme:fp/view_list_active' => 'fa-list',
 | 
        
           | 1441 | ariadna | 189 |             'theme:fp/view_tree_active' => 'fa-folder-tree',
 | 
        
           | 1 | efrain | 190 |             'core:i/activities' => 'fa-file-pen',
 | 
        
           | 1441 | ariadna | 191 |             'core:i/addblock' => 'fa-regular fa-square-plus',
 | 
        
           |  |  | 192 |             'core:i/assignroles' => 'fa-user-tag',
 | 
        
           | 1 | efrain | 193 |             'core:i/asterisk' => 'fa-asterisk',
 | 
        
           | 1441 | ariadna | 194 |             'core:i/backup' => 'fa-circle-arrow-down',
 | 
        
           |  |  | 195 |             'core:i/badge' => 'fa-award',
 | 
        
           |  |  | 196 |             'core:i/breadcrumbdivider' => 'fa-chevron-right',
 | 
        
           | 1 | efrain | 197 |             'core:i/bullhorn' => 'fa-bullhorn',
 | 
        
           |  |  | 198 |             'core:i/calc' => 'fa-calculator',
 | 
        
           | 1441 | ariadna | 199 |             'core:i/calendar' => 'fa-regular fa-calendar',
 | 
        
           | 1 | efrain | 200 |             'core:i/calendareventdescription' => 'fa-align-left',
 | 
        
           | 1441 | ariadna | 201 |             'core:i/calendareventtime' => 'fa-regular fa-clock',
 | 
        
           |  |  | 202 |             'core:i/categoryevent' => 'fa-shapes',
 | 
        
           |  |  | 203 |             'core:i/caution' => 'fa-warning text-warning',
 | 
        
           |  |  | 204 |             'core:i/chartbar' => 'fa-chart-bar',
 | 
        
           | 1 | efrain | 205 |             'core:i/checked' => 'fa-check',
 | 
        
           | 1441 | ariadna | 206 |             'core:i/checkedcircle' => 'fa-circle-check',
 | 
        
           |  |  | 207 |             'core:i/checkpermissions' => 'fa-user-lock',
 | 
        
           |  |  | 208 |             'core:i/circleinfo' => 'fa-circle-info',
 | 
        
           |  |  | 209 |             'core:i/cloudupload' => 'fa-cloud-upload',
 | 
        
           |  |  | 210 |             'core:i/cohort' => 'fa-users-line',
 | 
        
           |  |  | 211 |             'core:i/competencies' => 'fa-list-check',
 | 
        
           |  |  | 212 |             'core:i/completion_self' => 'fa-user-check',
 | 
        
           |  |  | 213 |             'core:i/contentbank' => 'fa-laptop-file',
 | 
        
           | 1 | efrain | 214 |             'core:i/course' => 'fa-graduation-cap',
 | 
        
           |  |  | 215 |             'core:i/courseevent' => 'fa-graduation-cap',
 | 
        
           | 1441 | ariadna | 216 |             'core:i/customfield' => 'fa-cog',
 | 
        
           |  |  | 217 |             'core:i/dashboard' => 'fa-gauge',
 | 
        
           | 1 | efrain | 218 |             'core:i/db' => 'fa-database',
 | 
        
           | 1441 | ariadna | 219 |             'core:i/delete' => 'fa-trash-can',
 | 
        
           | 1 | efrain | 220 |             'core:i/down' => 'fa-arrow-down',
 | 
        
           | 1441 | ariadna | 221 |             'core:i/dragdrop' => 'fa-arrows-up-down-left-right',
 | 
        
           |  |  | 222 |             'core:i/duration' => 'fa-hourglass',
 | 
        
           |  |  | 223 |             'core:i/edit' => 'fa-pen',
 | 
        
           |  |  | 224 |             'core:i/email' => 'fa-envelope',
 | 
        
           |  |  | 225 |             'core:i/emojicategoryactivities' => 'fa-futbol',
 | 
        
           | 1 | efrain | 226 |             'core:i/emojicategoryanimalsnature' => 'fa-leaf',
 | 
        
           |  |  | 227 |             'core:i/emojicategoryflags' => 'fa-flag',
 | 
        
           | 1441 | ariadna | 228 |             'core:i/emojicategoryfooddrink' => 'fa-pizza-slice',
 | 
        
           |  |  | 229 |             'core:i/emojicategoryobjects' => 'fa-hammer',
 | 
        
           |  |  | 230 |             'core:i/emojicategorypeoplebody' => 'fa-person',
 | 
        
           |  |  | 231 |             'core:i/emojicategoryrecent' => 'fa-regular fa-clock',
 | 
        
           |  |  | 232 |             'core:i/emojicategorysmileysemotion' => 'fa-regular fa-face-smile',
 | 
        
           |  |  | 233 |             'core:i/emojicategorysymbols' => 'fa-peace',
 | 
        
           | 1 | efrain | 234 |             'core:i/emojicategorytravelplaces' => 'fa-plane',
 | 
        
           | 1441 | ariadna | 235 |             'core:i/empty' => 'fa-regular fa-square',
 | 
        
           |  |  | 236 |             'core:i/enrolmentsuspended' => 'fa-user-xmark',
 | 
        
           | 1 | efrain | 237 |             'core:i/enrolusers' => 'fa-user-plus',
 | 
        
           | 1441 | ariadna | 238 |             'core:i/excluded' => 'fa-circle-minus',
 | 
        
           |  |  | 239 |             'core:i/expired' => 'fa-circle-exclamation text-warning',
 | 
        
           |  |  | 240 |             'core:i/externallink' => 'fa-arrow-up-right-from-square',
 | 
        
           |  |  | 241 |             'core:i/file_plus' => 'fa-file-circle-plus',
 | 
        
           | 1 | efrain | 242 |             'core:i/files' => 'fa-file',
 | 
        
           |  |  | 243 |             'core:i/filter' => 'fa-filter',
 | 
        
           |  |  | 244 |             'core:i/flagged' => 'fa-flag',
 | 
        
           |  |  | 245 |             'core:i/folder' => 'fa-folder',
 | 
        
           | 1441 | ariadna | 246 |             'core:i/grade_correct' => 'fa-regular fa-circle-check text-success',
 | 
        
           |  |  | 247 |             'core:i/grade_incorrect' => 'fa-regular fa-circle-xmark text-danger',
 | 
        
           |  |  | 248 |             'core:i/grades' => 'fa-clipboard-check',
 | 
        
           |  |  | 249 |             'core:i/grading' => 'fa-wand-magic-sparkles',
 | 
        
           |  |  | 250 |             'core:i/gradingnotifications' => 'fa-regular fa-bell',
 | 
        
           | 1 | efrain | 251 |             'core:i/group' => 'fa-users',
 | 
        
           | 1441 | ariadna | 252 |             'core:i/groupevent' => 'fa-users',
 | 
        
           |  |  | 253 |             'core:i/hide' => 'fa-regular fa-eye',
 | 
        
           | 1 | efrain | 254 |             'core:i/hierarchylock' => 'fa-lock',
 | 
        
           | 1441 | ariadna | 255 |             'core:i/home' => 'fa-house',
 | 
        
           | 1 | efrain | 256 |             'core:i/incorrect' => 'fa-exclamation',
 | 
        
           |  |  | 257 |             'core:i/info' => 'fa-info',
 | 
        
           | 1441 | ariadna | 258 |             'core:i/invalid' => 'fa-xmark text-danger',
 | 
        
           |  |  | 259 |             'core:i/language' => 'fa-language',
 | 
        
           |  |  | 260 |             'core:i/link' => 'fa-link',
 | 
        
           |  |  | 261 |             'core:i/loading' => 'fa-spinner fa-spin',
 | 
        
           |  |  | 262 |             'core:i/loading_small' => 'fa-spinner fa-spin fa-sm',
 | 
        
           |  |  | 263 |             'core:i/location' => 'fa-location-dot',
 | 
        
           | 1 | efrain | 264 |             'core:i/lock' => 'fa-lock',
 | 
        
           | 1441 | ariadna | 265 |             'core:i/log' => 'fa-check-to-slot',
 | 
        
           | 1 | efrain | 266 |             'core:i/mahara_host' => 'fa-id-badge',
 | 
        
           | 1441 | ariadna | 267 |             'core:i/manual_item' => 'fa-pen-to-square',
 | 
        
           |  |  | 268 |             'core:i/marked' => 'fa-solid fa-highlighter',
 | 
        
           |  |  | 269 |             'core:i/marker' => 'fa-pen-clip',
 | 
        
           | 1 | efrain | 270 |             'core:i/mean' => 'fa-calculator',
 | 
        
           | 1441 | ariadna | 271 |             'core:i/menu' => 'fa-ellipsis-vertical',
 | 
        
           | 1 | efrain | 272 |             'core:i/menubars' => 'fa-bars',
 | 
        
           | 1441 | ariadna | 273 |             'core:i/messagecontentaudio' => 'fa-volume-high',
 | 
        
           | 1 | efrain | 274 |             'core:i/messagecontentimage' => 'fa-image',
 | 
        
           | 1441 | ariadna | 275 |             'core:i/messagecontentmultimediageneral' => 'fa-photo-film',
 | 
        
           | 1 | efrain | 276 |             'core:i/messagecontentvideo' => 'fa-film',
 | 
        
           | 1441 | ariadna | 277 |             'core:i/mnethost' => 'fa-square-arrow-up-right',
 | 
        
           | 1 | efrain | 278 |             'core:i/moodle_host' => 'fa-graduation-cap',
 | 
        
           | 1441 | ariadna | 279 |             'core:i/moremenu' => 'fa-ellipsis',
 | 
        
           |  |  | 280 |             'core:i/move_2d' => 'fa-arrows-up-down-left-right',
 | 
        
           | 1 | efrain | 281 |             'core:i/muted' => 'fa-microphone-slash',
 | 
        
           |  |  | 282 |             'core:i/navigationitem' => 'fa-fw',
 | 
        
           | 1441 | ariadna | 283 |             'core:i/ne_red_mark' => 'fa-xmark text-danger',
 | 
        
           | 1 | efrain | 284 |             'core:i/new' => 'fa-bolt',
 | 
        
           | 1441 | ariadna | 285 |             'core:i/news' => 'fa-newspaper',
 | 
        
           | 1 | efrain | 286 |             'core:i/next' => 'fa-chevron-right',
 | 
        
           |  |  | 287 |             'core:i/nosubcat' => 'fa-plus-square-o',
 | 
        
           | 1441 | ariadna | 288 |             'core:i/notifications' => 'fa-bell',
 | 
        
           | 1 | efrain | 289 |             'core:i/open' => 'fa-folder-open',
 | 
        
           | 1441 | ariadna | 290 |             'core:i/otherevent' => 'fa-circle-info',
 | 
        
           |  |  | 291 |             'core:i/outcomes' => 'fa-list-check',
 | 
        
           |  |  | 292 |             'core:i/overriden_grade' => 'fa-pen-to-square',
 | 
        
           |  |  | 293 |             'core:i/payment' => 'fa-solid fa-credit-card',
 | 
        
           |  |  | 294 |             'core:i/permissionlock' => 'fa-user-lock',
 | 
        
           |  |  | 295 |             'core:i/permissions' => 'fa-user-lock',
 | 
        
           |  |  | 296 |             'core:i/persona_sign_in_black' => 'fa-person',
 | 
        
           |  |  | 297 |             'core:i/portfolio' => 'fa-briefcase',
 | 
        
           |  |  | 298 |             'core:i/preview' => 'fa-magnifying-glass-plus',
 | 
        
           | 1 | efrain | 299 |             'core:i/previous' => 'fa-chevron-left',
 | 
        
           | 1441 | ariadna | 300 |             'core:i/privatefiles' => 'fa-file-circle-minus',
 | 
        
           | 1 | efrain | 301 |             'core:i/progressbar' => 'fa-spinner fa-spin',
 | 
        
           | 1441 | ariadna | 302 |             'core:i/publish' => 'fa-arrow-up-from-bracket',
 | 
        
           | 1 | efrain | 303 |             'core:i/questions' => 'fa-question',
 | 
        
           | 1441 | ariadna | 304 |             'core:i/reload' => 'fa-rotate-right',
 | 
        
           |  |  | 305 |             'core:i/report' => 'fa-chart-column',
 | 
        
           |  |  | 306 |             'core:i/repository' => 'fa-hard-drive',
 | 
        
           |  |  | 307 |             'core:i/restore' => 'fa-trash-can-arrow-up',
 | 
        
           | 1 | efrain | 308 |             'core:i/return' => 'fa-arrow-left',
 | 
        
           | 1441 | ariadna | 309 |             'core:i/risk_config' => 'fa-triangle-exclamation text-muted',
 | 
        
           |  |  | 310 |             'core:i/risk_dataloss' => 'fa-triangle-exclamation text-danger',
 | 
        
           |  |  | 311 |             'core:i/risk_managetrust' => 'fa-triangle-exclamation text-warning',
 | 
        
           |  |  | 312 |             'core:i/risk_personal' => 'fa-triangle-exclamation text-info',
 | 
        
           |  |  | 313 |             'core:i/risk_spam' => 'fa-triangle-exclamation text-primary',
 | 
        
           |  |  | 314 |             'core:i/risk_xss' => 'fa-triangle-exclamation text-danger',
 | 
        
           |  |  | 315 |             'core:i/role' => 'fa-user-tie',
 | 
        
           | 1 | efrain | 316 |             'core:i/rss' => 'fa-rss',
 | 
        
           |  |  | 317 |             'core:i/rsssitelogo' => 'fa-graduation-cap',
 | 
        
           | 1441 | ariadna | 318 |             'core:i/scales' => 'fa-scale-balanced',
 | 
        
           |  |  | 319 |             'core:i/scheduled' => 'fa-regular fa-calendar-check',
 | 
        
           |  |  | 320 |             'core:i/search' => 'fa-magnifying-glass',
 | 
        
           |  |  | 321 |             'core:i/section' => 'fa-regular fa-rectangle-list',
 | 
        
           |  |  | 322 |             'core:i/sendmessage' => 'fa-regular fa-paper-plane',
 | 
        
           |  |  | 323 |             'core:i/settings' => 'fa-gear',
 | 
        
           |  |  | 324 |             'core:i/share' => 'fa-regular fa-share-from-square',
 | 
        
           |  |  | 325 |             'core:i/show' => 'fa-regular fa-eye-slash',
 | 
        
           |  |  | 326 |             'core:i/siteevent' => 'fa-solid fa-globe',
 | 
        
           | 1 | efrain | 327 |             'core:i/star' => 'fa-star',
 | 
        
           | 1441 | ariadna | 328 |             'core:i/star-o' => 'fa-regular fa-star',
 | 
        
           | 1 | efrain | 329 |             'core:i/star-rating' => 'fa-star',
 | 
        
           | 1441 | ariadna | 330 |             'core:i/stats' => 'fa-chart-line',
 | 
        
           |  |  | 331 |             'core:i/switch' => 'fa-right-left',
 | 
        
           |  |  | 332 |             'core:i/switchrole' => 'fa-people-arrows',
 | 
        
           |  |  | 333 |             'core:i/trash' => 'fa-trash-can',
 | 
        
           |  |  | 334 |             'core:i/twoway' => 'fa-arrows-left-right',
 | 
        
           |  |  | 335 |             'core:i/unchecked' => 'fa-regular fa-square',
 | 
        
           |  |  | 336 |             'core:i/uncheckedcircle' => 'fa-regular fa-circle',
 | 
        
           |  |  | 337 |             'core:i/unflagged' => 'fa-regular fa-flag',
 | 
        
           | 1 | efrain | 338 |             'core:i/unlock' => 'fa-unlock',
 | 
        
           |  |  | 339 |             'core:i/up' => 'fa-arrow-up',
 | 
        
           |  |  | 340 |             'core:i/upload' => 'fa-upload',
 | 
        
           |  |  | 341 |             'core:i/user' => 'fa-user',
 | 
        
           | 1441 | ariadna | 342 |             'core:i/userevent' => 'fa-clipboard-user',
 | 
        
           |  |  | 343 |             'core:i/users' => 'fa-user-group',
 | 
        
           | 1 | efrain | 344 |             'core:i/valid' => 'fa-check text-success',
 | 
        
           | 1441 | ariadna | 345 |             'core:i/viewcategory' => 'fa-pager',
 | 
        
           | 1 | efrain | 346 |             'core:i/viewsection' => 'fa-pager',
 | 
        
           | 1441 | ariadna | 347 |             'core:i/warning' => 'fa-triangle-exclamation text-warning',
 | 
        
           |  |  | 348 |             'core:i/window_close' => 'fa-xmark',
 | 
        
           |  |  | 349 |             'core:i/withsubcat' => 'fa-network-wired',
 | 
        
           |  |  | 350 |             'core:m/USD' => 'fa-dollar-sign',
 | 
        
           |  |  | 351 |             'core:t/add' => 'fa-plus',
 | 
        
           | 1 | efrain | 352 |             'core:t/addcontact' => 'fa-address-card',
 | 
        
           |  |  | 353 |             'core:t/angles-down' => 'fa-angles-down',
 | 
        
           |  |  | 354 |             'core:t/angles-left' => 'fa-angles-left',
 | 
        
           |  |  | 355 |             'core:t/angles-right' => 'fa-angles-right',
 | 
        
           |  |  | 356 |             'core:t/angles-up' => 'fa-angles-up',
 | 
        
           |  |  | 357 |             'core:t/approve' => 'fa-thumbs-up',
 | 
        
           | 1441 | ariadna | 358 |             'core:t/assignroles' => 'fa-user-tag',
 | 
        
           |  |  | 359 |             'core:t/award' => 'fa-award',
 | 
        
           |  |  | 360 |             'core:t/backpack' => 'fa-suitcase-rolling',
 | 
        
           |  |  | 361 |             'core:t/backup' => 'fa-circle-arrow-down',
 | 
        
           | 1 | efrain | 362 |             'core:t/block' => 'fa-ban',
 | 
        
           | 1441 | ariadna | 363 |             'core:t/block_to_dock' => 'fa-chevron-left',
 | 
        
           | 1 | efrain | 364 |             'core:t/block_to_dock_rtl' => 'fa-chevron-right',
 | 
        
           |  |  | 365 |             'core:t/blocks_drawer' => 'fa-chevron-left',
 | 
        
           |  |  | 366 |             'core:t/blocks_drawer_rtl' => 'fa-chevron-right',
 | 
        
           | 1441 | ariadna | 367 |             'core:t/calc_off' => 'fa-calculator',
 | 
        
           | 1 | efrain | 368 |             'core:t/calc' => 'fa-calculator',
 | 
        
           |  |  | 369 |             'core:t/check' => 'fa-check',
 | 
        
           |  |  | 370 |             'core:t/clipboard' => 'fa-clipboard',
 | 
        
           | 1441 | ariadna | 371 |             'core:t/cohort' => 'fa-users-line',
 | 
        
           |  |  | 372 |             'core:t/collapsed_empty_rtl' => 'fa-chevron-left',
 | 
        
           |  |  | 373 |             'core:t/collapsed_empty' => 'fa-chevron-right',
 | 
        
           |  |  | 374 |             'core:t/collapsed_rtl' => 'fa-chevron-left',
 | 
        
           |  |  | 375 |             'core:t/collapsed' => 'fa-chevron-right',
 | 
        
           | 1 | efrain | 376 |             'core:t/collapsedchevron' => 'fa-chevron-right',
 | 
        
           |  |  | 377 |             'core:t/collapsedchevron_rtl' => 'fa-chevron-left',
 | 
        
           |  |  | 378 |             'core:t/collapsedchevron_up' => 'fa-chevron-up',
 | 
        
           |  |  | 379 |             'core:t/completion_complete' => 'fa-circle',
 | 
        
           | 1441 | ariadna | 380 |             'core:t/completion_fail' => 'fa-xmark',
 | 
        
           |  |  | 381 |             'core:t/contextmenu' => 'fa-ellipsis-vertical',
 | 
        
           |  |  | 382 |             'core:t/copy' => 'fa-solid fa-clone',
 | 
        
           |  |  | 383 |             'core:t/delete' => 'fa-trash-can',
 | 
        
           |  |  | 384 |             'core:t/dock_to_block_rtl' => 'fa-chevron-left',
 | 
        
           |  |  | 385 |             'core:t/dock_to_block' => 'fa-chevron-right',
 | 
        
           |  |  | 386 |             'core:t/dockclose' => 'fa-xmark',
 | 
        
           |  |  | 387 |             'core:t/down' => 'fa-arrow-down',
 | 
        
           | 1 | efrain | 388 |             'core:t/download' => 'fa-download',
 | 
        
           | 1441 | ariadna | 389 |             'core:t/downlong' => 'fa-arrow-down-long',
 | 
        
           |  |  | 390 |             'core:t/dropdown' => 'fa-caret-down',
 | 
        
           |  |  | 391 |             'core:t/edit_menu' => 'fa-ellipsis-vertical',
 | 
        
           |  |  | 392 |             'core:t/edit' => 'fa-pen',
 | 
        
           |  |  | 393 |             'core:t/editinline' => 'fa-pen',
 | 
        
           |  |  | 394 |             'core:t/editstring' => 'fa-pen',
 | 
        
           |  |  | 395 |             'core:t/email' => 'fa-regular fa-envelope',
 | 
        
           | 1 | efrain | 396 |             'core:t/emailno' => 'fa-ban',
 | 
        
           | 1441 | ariadna | 397 |             'core:t/emptystar' => 'fa-regular fa-star',
 | 
        
           | 1 | efrain | 398 |             'core:t/enrolusers' => 'fa-user-plus',
 | 
        
           | 1441 | ariadna | 399 |             'core:t/expanded' => 'fa-chevron-down',
 | 
        
           | 1 | efrain | 400 |             'core:t/expandedchevron' => 'fa-chevron-down',
 | 
        
           |  |  | 401 |             'core:t/go' => 'fa-play',
 | 
        
           | 1441 | ariadna | 402 |             'core:t/grades' => 'fa-table-list',
 | 
        
           | 1 | efrain | 403 |             'core:t/groupn' => 'fa-user',
 | 
        
           | 1441 | ariadna | 404 |             'core:t/groups' => 'fa-circle-user',
 | 
        
           |  |  | 405 |             'core:t/groupv' => 'fa-regular fa-circle-user',
 | 
        
           |  |  | 406 |             'core:t/hide' => 'fa-regular fa-eye',
 | 
        
           | 1 | efrain | 407 |             'core:t/index_drawer' => 'fa-list',
 | 
        
           |  |  | 408 |             'core:t/left' => 'fa-arrow-left',
 | 
        
           | 1441 | ariadna | 409 |             'core:t/less' => 'fa-minus',
 | 
        
           | 1 | efrain | 410 |             'core:t/life-ring' => 'fa-life-ring',
 | 
        
           | 1441 | ariadna | 411 |             'core:t/lock' => 'fa-unlock',
 | 
        
           | 1 | efrain | 412 |             'core:t/locked' => 'fa-lock',
 | 
        
           | 1441 | ariadna | 413 |             'core:t/log' => 'fa-history',
 | 
        
           | 1 | efrain | 414 |             'core:t/markasread' => 'fa-check',
 | 
        
           | 1441 | ariadna | 415 |             'core:t/message' => 'fa-message',
 | 
        
           | 1 | efrain | 416 |             'core:t/messages' => 'fa-comments',
 | 
        
           | 1441 | ariadna | 417 |             'core:t/messages-o' => 'fa-regular fa-comments',
 | 
        
           | 1 | efrain | 418 |             'core:t/more' => 'fa-caret-down',
 | 
        
           | 1441 | ariadna | 419 |             'core:t/move' => 'fa-arrows-up-down',
 | 
        
           |  |  | 420 |             'core:t/online' => 'fa-circle-check',
 | 
        
           |  |  | 421 |             'core:t/passwordunmask-edit' => 'fa-pen',
 | 
        
           |  |  | 422 |             'core:t/passwordunmask-reveal' => 'fa-solid fa-eye',
 | 
        
           | 1 | efrain | 423 |             'core:t/play' => 'fa-play',
 | 
        
           |  |  | 424 |             'core:t/portfolioadd' => 'fa-plus',
 | 
        
           |  |  | 425 |             'core:t/preferences' => 'fa-wrench',
 | 
        
           | 1441 | ariadna | 426 |             'core:t/preview' => 'fa-magnifying-glass-plus',
 | 
        
           | 1 | efrain | 427 |             'core:t/print' => 'fa-print',
 | 
        
           | 1441 | ariadna | 428 |             'core:t/reload' => 'fa-rotate-right',
 | 
        
           |  |  | 429 |             'core:t/removecontact' => 'fa-user-xmark',
 | 
        
           |  |  | 430 |             'core:t/reset' => 'fa-arrow-rotate-left',
 | 
        
           |  |  | 431 |             'core:t/restore' => 'fa-trash-can-arrow-up',
 | 
        
           | 1 | efrain | 432 |             'core:t/right' => 'fa-arrow-right',
 | 
        
           | 1441 | ariadna | 433 |             'core:t/sendmessage' => 'fa-regular fa-paper-plane',
 | 
        
           | 1 | efrain | 434 |             'core:t/show' => 'fa-eye-slash',
 | 
        
           | 1441 | ariadna | 435 |             'core:t/sort_asc' => 'fa-arrow-up-short-wide',
 | 
        
           |  |  | 436 |             'core:t/sort_by' => 'fa-arrow-down-wide-short',
 | 
        
           |  |  | 437 |             'core:t/sort_desc' => 'fa-arrow-down-short-wide',
 | 
        
           | 1 | efrain | 438 |             'core:t/sort' => 'fa-sort',
 | 
        
           |  |  | 439 |             'core:t/stealth' => 'fa-low-vision',
 | 
        
           |  |  | 440 |             'core:t/stop' => 'fa-stop',
 | 
        
           |  |  | 441 |             'core:t/switch_minus' => 'fa-minus',
 | 
        
           |  |  | 442 |             'core:t/switch_plus' => 'fa-plus',
 | 
        
           | 1441 | ariadna | 443 |             'core:t/switch_whole' => 'fa-regular fa-square',
 | 
        
           | 1 | efrain | 444 |             'core:t/tags' => 'fa-tags',
 | 
        
           | 1441 | ariadna | 445 |             'core:t/unblock' => 'fa-unlock-keyhole',
 | 
        
           | 1 | efrain | 446 |             'core:t/unlock' => 'fa-lock',
 | 
        
           | 1441 | ariadna | 447 |             'core:t/unlocked' => 'fa-lock-open',
 | 
        
           | 1 | efrain | 448 |             'core:t/up' => 'fa-arrow-up',
 | 
        
           | 1441 | ariadna | 449 |             'core:t/uplong' => 'fa-arrow-up-long',
 | 
        
           | 1 | efrain | 450 |             'core:t/user' => 'fa-user',
 | 
        
           | 1441 | ariadna | 451 |             'core:t/viewdetails' => 'fa-magnifying-glass-plus',
 | 
        
           | 1 | efrain | 452 |         ];
 | 
        
           |  |  | 453 |     }
 | 
        
           |  |  | 454 |   | 
        
           | 1441 | ariadna | 455 |     #[\Override]
 | 
        
           |  |  | 456 |     public function get_deprecated_icons(): array {
 | 
        
           |  |  | 457 |         // Add deprecated core icons to parent deprecated icons.
 | 
        
           |  |  | 458 |         return array_merge(
 | 
        
           |  |  | 459 |             parent::get_deprecated_icons(),
 | 
        
           |  |  | 460 |             [
 | 
        
           |  |  | 461 |                 // Deprecated since Moodle 5.0.
 | 
        
           |  |  | 462 |                 'core:a/em1_bwgreater',
 | 
        
           |  |  | 463 |                 'core:a/em1_greater',
 | 
        
           |  |  | 464 |                 'core:a/em1_lesser',
 | 
        
           |  |  | 465 |                 'core:a/em1_raquo',
 | 
        
           |  |  | 466 |                 'core:a/l_breadcrumb',
 | 
        
           |  |  | 467 |                 'core:a/r_breadcrumb',
 | 
        
           |  |  | 468 |                 'core:a/r_go',
 | 
        
           |  |  | 469 |                 'core:a/r_next',
 | 
        
           |  |  | 470 |                 'core:a/r_previous',
 | 
        
           |  |  | 471 |                 'core:adv',
 | 
        
           |  |  | 472 |                 'core:c/event',
 | 
        
           |  |  | 473 |                 'core:e/layers_over',
 | 
        
           |  |  | 474 |                 'core:e/layers_under',
 | 
        
           |  |  | 475 |                 'core:e/row_props',
 | 
        
           |  |  | 476 |                 'core:e/styleprops',
 | 
        
           |  |  | 477 |                 'core:i/admin',
 | 
        
           |  |  | 478 |                 'core:i/closed',
 | 
        
           |  |  | 479 |                 'core:i/dropdown',
 | 
        
           |  |  | 480 |                 'core:i/emojicategorysmileyspeople',
 | 
        
           |  |  | 481 |                 'core:i/feedback',
 | 
        
           |  |  | 482 |                 'core:i/feedback_add',
 | 
        
           |  |  | 483 |                 'core:i/grademark',
 | 
        
           |  |  | 484 |                 'core:i/grademark-grey',
 | 
        
           |  |  | 485 |                 'core:i/guest',
 | 
        
           |  |  | 486 |                 'core:i/ical',
 | 
        
           |  |  | 487 |                 'core:i/key',
 | 
        
           |  |  | 488 |                 'core:i/mahara_host',
 | 
        
           |  |  | 489 |                 'core:madewithmoodle',
 | 
        
           |  |  | 490 |                 'core:t/adddir',
 | 
        
           |  |  | 491 |                 'core:t/addfile',
 | 
        
           |  |  | 492 |                 'core:t/arrow_left',
 | 
        
           |  |  | 493 |                 'core:t/calendar',
 | 
        
           |  |  | 494 |                 'core:t/collapsedcaret',
 | 
        
           |  |  | 495 |                 'core:t/enroladd',
 | 
        
           |  |  | 496 |                 'core:t/feedback',
 | 
        
           |  |  | 497 |                 'core:t/feedback_add',
 | 
        
           |  |  | 498 |                 'core:t/hiddenuntil',
 | 
        
           |  |  | 499 |                 'core:t/hideuntil',
 | 
        
           |  |  | 500 |                 'core:t/mean',
 | 
        
           |  |  | 501 |                 'core:t/moveleft',
 | 
        
           |  |  | 502 |                 'core:t/nonempty',
 | 
        
           |  |  | 503 |                 'core:t/outcomes',
 | 
        
           |  |  | 504 |                 'core:t/ranges',
 | 
        
           |  |  | 505 |                 'core:t/removeright',
 | 
        
           |  |  | 506 |                 'core:t/scales',
 | 
        
           |  |  | 507 |                 'core:t/sigma',
 | 
        
           |  |  | 508 |                 'core:t/sigmaplus',
 | 
        
           |  |  | 509 |                 'core:t/switch',
 | 
        
           |  |  | 510 |                 'core:t/usernot',
 | 
        
           |  |  | 511 |                 'core:webding',
 | 
        
           |  |  | 512 |                 'theme:fp/dnd_arrow',
 | 
        
           |  |  | 513 |                 'theme:fp/folder',
 | 
        
           |  |  | 514 |                 'theme:fp/list',
 | 
        
           |  |  | 515 |                 'theme:fp/th',
 | 
        
           |  |  | 516 |                 'theme:mod/quiz/checkmark',
 | 
        
           |  |  | 517 |                 'theme:mod/quiz/flag-on',
 | 
        
           |  |  | 518 |                 'theme:mod/quiz/warningtriangle',
 | 
        
           |  |  | 519 |                 'theme:mod/quiz/whitecircle',
 | 
        
           |  |  | 520 |             ],
 | 
        
           |  |  | 521 |         );
 | 
        
           |  |  | 522 |     }
 | 
        
           |  |  | 523 |   | 
        
           | 1 | efrain | 524 |     /**
 | 
        
           |  |  | 525 |      * Overridable function to get a mapping of all icons.
 | 
        
           |  |  | 526 |      * Default is to do no mapping.
 | 
        
           |  |  | 527 |      */
 | 
        
           |  |  | 528 |     public function get_icon_name_map() {
 | 
        
           |  |  | 529 |         if ($this->map === []) {
 | 
        
           |  |  | 530 |             $cache = \cache::make('core', 'fontawesomeiconmapping');
 | 
        
           |  |  | 531 |   | 
        
           |  |  | 532 |             // Create different mapping keys for different icon system classes, there may be several different
 | 
        
           |  |  | 533 |             // themes on the same site.
 | 
        
           | 1441 | ariadna | 534 |             $mapkey = 'mapping_' . preg_replace('/[^a-zA-Z0-9_]/', '_', get_class($this));
 | 
        
           | 1 | efrain | 535 |             $this->map = $cache->get($mapkey);
 | 
        
           |  |  | 536 |   | 
        
           |  |  | 537 |             if (empty($this->map)) {
 | 
        
           |  |  | 538 |                 $this->map = $this->get_core_icon_map();
 | 
        
           |  |  | 539 |                 $callback = 'get_fontawesome_icon_map';
 | 
        
           |  |  | 540 |   | 
        
           |  |  | 541 |                 if ($pluginsfunction = get_plugins_with_function($callback)) {
 | 
        
           |  |  | 542 |                     foreach ($pluginsfunction as $plugintype => $plugins) {
 | 
        
           |  |  | 543 |                         foreach ($plugins as $pluginfunction) {
 | 
        
           |  |  | 544 |                             $pluginmap = $pluginfunction();
 | 
        
           |  |  | 545 |                             $this->map += $pluginmap;
 | 
        
           |  |  | 546 |                         }
 | 
        
           |  |  | 547 |                     }
 | 
        
           |  |  | 548 |                 }
 | 
        
           | 1441 | ariadna | 549 |   | 
        
           |  |  | 550 |                 $deprecated = $this->get_deprecated_icons();
 | 
        
           |  |  | 551 |                 foreach ($this->map as $from => $to) {
 | 
        
           |  |  | 552 |                     // Add the solid class by default to all icons that have not specific family.
 | 
        
           |  |  | 553 |                     $this->map[$from] = $this->add_family($to);
 | 
        
           |  |  | 554 |                     // Add the deprecated class to all deprecated icons.
 | 
        
           |  |  | 555 |                     if (in_array($from, $deprecated)) {
 | 
        
           |  |  | 556 |                         $this->map[$from] .= ' deprecated deprecated-'.$from;
 | 
        
           |  |  | 557 |                     }
 | 
        
           |  |  | 558 |                 }
 | 
        
           |  |  | 559 |   | 
        
           | 1 | efrain | 560 |                 $cache->set($mapkey, $this->map);
 | 
        
           |  |  | 561 |             }
 | 
        
           |  |  | 562 |         }
 | 
        
           |  |  | 563 |         return $this->map;
 | 
        
           |  |  | 564 |     }
 | 
        
           |  |  | 565 |   | 
        
           | 1441 | ariadna | 566 |     /**
 | 
        
           |  |  | 567 |      * Add the family to the icon if not present.
 | 
        
           |  |  | 568 |      *
 | 
        
           |  |  | 569 |      * @param string $cssclasses The icon classes.
 | 
        
           |  |  | 570 |      * @return string The icon classes with the family.
 | 
        
           |  |  | 571 |      */
 | 
        
           |  |  | 572 |     protected function add_family(string $cssclasses): string {
 | 
        
           |  |  | 573 |         $family = array_intersect(explode(' ', $cssclasses), $this->families);
 | 
        
           |  |  | 574 |         if (count($family) != 0) {
 | 
        
           |  |  | 575 |             return $cssclasses;
 | 
        
           |  |  | 576 |         }
 | 
        
           | 1 | efrain | 577 |   | 
        
           | 1441 | ariadna | 578 |         return 'fa ' . $cssclasses;
 | 
        
           |  |  | 579 |     }
 | 
        
           |  |  | 580 |   | 
        
           |  |  | 581 |     #[\Override]
 | 
        
           | 1 | efrain | 582 |     public function get_amd_name() {
 | 
        
           |  |  | 583 |         return 'core/icon_system_fontawesome';
 | 
        
           |  |  | 584 |     }
 | 
        
           |  |  | 585 |   | 
        
           | 1441 | ariadna | 586 |     #[\Override]
 | 
        
           | 1 | efrain | 587 |     public function render_pix_icon(renderer_base $output, pix_icon $icon) {
 | 
        
           |  |  | 588 |         $subtype = 'pix_icon_fontawesome';
 | 
        
           |  |  | 589 |         $subpix = new $subtype($icon);
 | 
        
           |  |  | 590 |   | 
        
           |  |  | 591 |         $data = $subpix->export_for_template($output);
 | 
        
           |  |  | 592 |   | 
        
           |  |  | 593 |         if (!$subpix->is_mapped()) {
 | 
        
           |  |  | 594 |             $data['unmappedIcon'] = $icon->export_for_template($output);
 | 
        
           | 1441 | ariadna | 595 |             // If the icon is not mapped, we need to check if it is deprecated.
 | 
        
           |  |  | 596 |             $component = $icon->component;
 | 
        
           |  |  | 597 |             if (empty($component) || $component === 'moodle' || $component === 'core') {
 | 
        
           |  |  | 598 |                 $component = 'core';
 | 
        
           |  |  | 599 |             }
 | 
        
           |  |  | 600 |             $iconname = $component . ':' . $icon->pix;
 | 
        
           |  |  | 601 |             if (in_array($iconname, $this->get_deprecated_icons())) {
 | 
        
           |  |  | 602 |                 $data['unmappedIcon']['extraclasses'] .= ' deprecated deprecated-'.$iconname;
 | 
        
           |  |  | 603 |             }
 | 
        
           | 1 | efrain | 604 |         }
 | 
        
           |  |  | 605 |         if (isset($icon->attributes['aria-hidden'])) {
 | 
        
           |  |  | 606 |             $data['aria-hidden'] = $icon->attributes['aria-hidden'];
 | 
        
           |  |  | 607 |         }
 | 
        
           |  |  | 608 |   | 
        
           |  |  | 609 |         // Flip question mark icon orientation when the `questioniconfollowlangdirection` lang config string is set to `yes`.
 | 
        
           |  |  | 610 |         $isquestionicon = strpos($data['key'], 'fa-question') !== false;
 | 
        
           |  |  | 611 |         if ($isquestionicon && right_to_left() && get_string('questioniconfollowlangdirection', 'langconfig') === 'yes') {
 | 
        
           |  |  | 612 |             $data['extraclasses'] = "fa-flip-horizontal";
 | 
        
           |  |  | 613 |         }
 | 
        
           |  |  | 614 |   | 
        
           |  |  | 615 |         return $output->render_from_template('core/pix_icon_fontawesome', $data);
 | 
        
           |  |  | 616 |     }
 | 
        
           |  |  | 617 | }
 |