Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core\output\icon_system Class Reference

Class allowing different systems for mapping and rendering icons. More...

Inheritance diagram for core\output\icon_system:
core\output\icon_system_font core\output\icon_system_standard core\output\icon_system_fontawesome theme_classic\output\icon_system_fontawesome

Public Member Functions

 get_amd_name ()
 The name of an AMD module extending core/icon_system.
 
 get_icon_name_map ()
 Overridable function to get a mapping of all icons.
 
 remap_icon_name ($iconname, $component)
 Overridable function to map the icon name to something else.
 
 render_pix_icon (renderer_base $output, pix_icon $icon)
 Render the pix icon according to the icon system.
 

Static Public Member Functions

static instance ($type=null)
 Factory method.
 
static is_valid_system ($system)
 Validate the theme config setting.
 
static reset_caches ()
 Clears the instance cache, for use in unit tests.
 

Public Attributes

string const FONTAWESOME = '\\core\\output\\icon_system_fontawesome'
 Default icon system.
 
string const STANDARD = '\\core\\output\\icon_system_standard'
 Default icon system.
 

Detailed Description

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).
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_amd_name()

core\output\icon_system::get_amd_name ( )
abstract

The name of an AMD module extending core/icon_system.

Return values
string

Reimplemented in core\output\icon_system_fontawesome, and core\output\icon_system_standard.

◆ get_icon_name_map()

core\output\icon_system::get_icon_name_map ( )

Overridable function to get a mapping of all icons.

Default is to do no mapping.

Reimplemented in core\output\icon_system_fontawesome.

◆ instance()

static core\output\icon_system::instance ( $type = null)
staticfinal

Factory method.

Parameters
string$typeEither a specific type, or null to get the default type.
Return values
core\output\icon_system

◆ is_valid_system()

static core\output\icon_system::is_valid_system ( $system)
staticfinal

Validate the theme config setting.

Parameters
string$system
Return values
boolean

◆ remap_icon_name()

core\output\icon_system::remap_icon_name ( $iconname,
$component )
final

Overridable function to map the icon name to something else.

Default is to do no mapping. Map is cached in the singleton.

◆ render_pix_icon()

core\output\icon_system::render_pix_icon ( renderer_base $output,
pix_icon $icon )
abstract

Render the pix icon according to the icon system.

Parameters
renderer_base$output
pix_icon$icon
Return values
string

Reimplemented in core\output\icon_system_fontawesome, and core\output\icon_system_standard.


The documentation for this class was generated from the following file: