| [ Index ] |
PHP Cross Reference of Moodle 310 |
[Summary view] [Print] [Text view]
1 // This file is part of Moodle - http://moodle.org/ 2 // 3 // Moodle is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU General Public License as published by 5 // the Free Software Foundation, either version 3 of the License, or 6 // (at your option) any later version. 7 // 8 // Moodle is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU General Public License for more details. 12 // 13 // You should have received a copy of the GNU General Public License 14 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 15 16 /** 17 * Competency rule points module. 18 * 19 * @module core/icon_system_standard 20 * @copyright 2017 Damyon Wiese 21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 */ 23 24 define(['core/icon_system', 'core/url', 'core/mustache'], 25 function(IconSystem, CoreUrl, Mustache) { 26 27 /** 28 * IconSystemStandard 29 * 30 * @class core/icon_system_standard 31 */ 32 var IconSystemStandard = function() { 33 IconSystem.apply(this, arguments); 34 }; 35 IconSystemStandard.prototype = Object.create(IconSystem.prototype); 36 37 /** 38 * Render an icon. 39 * 40 * @method renderIcon 41 * @param {String} key 42 * @param {String} component 43 * @param {String} title 44 * @param {String} template 45 * @return {String} 46 */ 47 IconSystemStandard.prototype.renderIcon = function(key, component, title, template) { 48 var url = CoreUrl.imageUrl(key, component); 49 50 var templatecontext = { 51 attributes: [ 52 {name: 'src', value: url}, 53 {name: 'alt', value: title}, 54 {name: 'title', value: title} 55 ] 56 }; 57 if (typeof title === "undefined" || title == "") { 58 templatecontext.attributes.push({name: 'aria-hidden', value: 'true'}); 59 } 60 61 var result = Mustache.render(template, templatecontext); 62 return result.trim(); 63 }; 64 65 /** 66 * Get the name of the template to pre-cache for this icon system. 67 * 68 * @return {String} 69 * @method getTemplateName 70 */ 71 IconSystemStandard.prototype.getTemplateName = function() { 72 return 'core/pix_icon'; 73 }; 74 75 return IconSystemStandard; 76 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 22 11:59:49 2025 | Cross-referenced by PHPXref 0.7.1 |