Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Member Functions | List of all members
emoticon_manager Class Reference

Provides core support for plugins that have to deal with emoticons (like HTML editor or emoticon filter). More...

Public Member Functions

 decode_stored_config ($encoded)
 Decodes the string into an array of emoticon objects. More...
 
 default_emoticons ()
 Returns default set of emoticons supported by Moodle. More...
 
 encode_stored_config (array $emoticons)
 Encodes the array of emoticon objects into a string storable in config table. More...
 
 get_emoticons ($selectable=false)
 Returns the currently enabled emoticons. More...
 
 prepare_renderable_emoticon (stdClass $emoticon, array $attributes=array())
 Converts emoticon object into renderable pix_emoticon object. More...
 

Protected Member Functions

 prepare_emoticon_object ($text, $imagename, $altidentifier=null, $altcomponent='core_pix', $imagecomponent='core')
 Helper method preparing the stdClass with the emoticon properties. More...
 

Detailed Description

Provides core support for plugins that have to deal with emoticons (like HTML editor or emoticon filter).

Whenever this manager mentiones 'emoticon object', the following data structure is expected: stdClass with properties text, imagename, imagecomponent, altidentifier and altcomponent

See also
admin_setting_emoticons
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ decode_stored_config()

emoticon_manager::decode_stored_config (   $encoded)

Decodes the string into an array of emoticon objects.

See also
self::encode_stored_config()
Parameters
string$encoded
Return values
string|null

◆ default_emoticons()

emoticon_manager::default_emoticons ( )

Returns default set of emoticons supported by Moodle.

Return values
arrayof sdtClasses

◆ encode_stored_config()

emoticon_manager::encode_stored_config ( array  $emoticons)

Encodes the array of emoticon objects into a string storable in config table.

See also
self::decode_stored_config()
Parameters
array$emoticonsarray of emtocion objects
Return values
string

◆ get_emoticons()

emoticon_manager::get_emoticons (   $selectable = false)

Returns the currently enabled emoticons.

Parameters
boolean$selectable- If true, only return emoticons that should be selectable from a list.
Return values
arrayof emoticon objects

◆ prepare_emoticon_object()

emoticon_manager::prepare_emoticon_object (   $text,
  $imagename,
  $altidentifier = null,
  $altcomponent = 'core_pix',
  $imagecomponent = 'core' 
)
protected

Helper method preparing the stdClass with the emoticon properties.

Parameters
string | array$textor array of strings
string$imagenameto be used by pix_emoticon
string$altidentifieralternative string identifier, null for no alt
string$altcomponentwhere the alternative string is defined
string$imagecomponentto be used by pix_emoticon
Return values
stdClass

◆ prepare_renderable_emoticon()

emoticon_manager::prepare_renderable_emoticon ( stdClass  $emoticon,
array  $attributes = array() 
)

Converts emoticon object into renderable pix_emoticon object.

Parameters
stdClass$emoticonemoticon object
array$attributesexplicit HTML attributes to set
Return values
pix_emoticon

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