|
static | create_instance (cm_info $cminfo) |
| Creates an instance of activityclass for the given course module, in case it implements it.
|
|
|
array const | STYLES |
| Badge defined styles.
|
|
|
| update_content () |
| This method will be called before exporting the template.
|
|
|
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.
|
|
◆ 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
-
- Return values
-
self|null | An 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 | $output | typically, the renderer that's calling this function |
- Return values
-
stdClass | data context for a mustache template |
Implements templatable.
◆ get_template_name()
core\output\named_templatable::get_template_name |
( |
\renderer_base | $renderer | ) |
|
|
inherited |
◆ update_content()
mod_resource\output\courseformat\activitybadge::update_content |
( |
| ) |
|
|
protected |
◆ $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:
- mod/resource/classes/output/courseformat/activitybadge.php