Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
mod_resource\output\courseformat\activitybadge Class Reference
Inheritance diagram for mod_resource\output\courseformat\activitybadge:
core_courseformat\output\activitybadge core\output\named_templatable renderable templatable

Public Member Functions

 export_for_template (renderer_base $output)
 Export this data so it can be used as the context for a mustache template.
 
 get_template_name (\renderer_base $renderer)
 Get the name of the template to use for this templatable.
 

Static Public Member Functions

static create_instance (cm_info $cminfo)
 Creates an instance of activityclass for the given course module, in case it implements it.
 

Public Attributes

array const STYLES
 Badge defined styles.
 

Protected Member Functions

 update_content ()
 This method will be called before exporting the template.
 

Protected Attributes

cm_info $cminfo = null
 The course module information.
 
string $content = null
 The content to be displayed in the activity badge.
 
string $elementid = null
 An optional element id in case the module wants to add some code for the activity badge (events, CSS...).
 
array $extraattributes = []
 An optional array of extra HTML attributes to add to the badge element (for example, data attributes).
 
string $style = self::STYLES['none']
 The style for the activity badge.
 
moodle_url $url = null
 An optional URL to redirect the user when the activity badge is clicked.
 

Member Function Documentation

◆ create_instance()

static core_courseformat\output\activitybadge::create_instance ( cm_info $cminfo)
staticfinalinherited

Creates an instance of activityclass for the given course module, in case it implements it.

Parameters
cm_info$cminfo
Return values
self|nullAn instance of activityclass for the given module or null if the module doesn't implement it.

◆ export_for_template()

core_courseformat\output\activitybadge::export_for_template ( renderer_base $output)
finalinherited

Export this data so it can be used as the context for a mustache template.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
Return values
stdClassdata context for a mustache template

Implements templatable.

◆ get_template_name()

core\output\named_templatable::get_template_name ( \renderer_base $renderer)
inherited

Get the name of the template to use for this templatable.

Parameters
renderer_base$rendererThe renderer requesting the template name
Return values
string

Implemented in core\output\local\dropdown\dialog, core\output\local\dropdown\status, core\output\sticky_footer, core_courseformat\output\local\content\cm\title, mod_quiz\output\list_of_attempts, and qbank_viewquestionname\output\questionname.

◆ update_content()

mod_resource\output\courseformat\activitybadge::update_content ( )
protected

This method will be called before exporting the template.

Reimplemented from core_courseformat\output\activitybadge.

Member Data Documentation

◆ $content

string core_courseformat\output\activitybadge::$content = null
protectedinherited

The content to be displayed in the activity badge.


◆ $extraattributes

array core_courseformat\output\activitybadge::$extraattributes = []
protectedinherited

An optional array of extra HTML attributes to add to the badge element (for example, data attributes).

The format for this array is [['name' => 'attr1', 'value' => 'attrval1'], ['name' => 'attr2', 'value' => 'attrval2']].

◆ $style

string core_courseformat\output\activitybadge::$style = self::STYLES['none']
protectedinherited

The style for the activity badge.


◆ $url

moodle_url core_courseformat\output\activitybadge::$url = null
protectedinherited

An optional URL to redirect the user when the activity badge is clicked.


◆ STYLES

array const core_courseformat\output\activitybadge::STYLES
inherited
Initial value:
= [
'none' => 'badge-none',
'dark' => 'bg-dark text-white',
'danger' => 'bg-danger text-white',
'warning' => 'bg-warning text-dark',
'info' => 'bg-info text-white',
]

Badge defined styles.


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