Base class to render an activity badge.
More...
|
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.
|
|
Base class to render an activity badge.
Plugins can extend this class and override some methods to customize the content to be displayed in the activity badge.
- Copyright
- 2023 Sara Arjona sara@.nosp@m.mood.nosp@m.le.co.nosp@m.m
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
core_courseformat\output\activitybadge::__construct |
( |
cm_info | $cminfo | ) |
|
Constructor.
- Parameters
-
cm_info | $cminfo | The course module information. |
◆ create_instance()
static core_courseformat\output\activitybadge::create_instance |
( |
cm_info | $cminfo | ) |
|
|
staticfinal |
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 | ) |
|
|
final |
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()
core_courseformat\output\activitybadge::update_content |
( |
| ) |
|
|
abstractprotected |
◆ $content
string core_courseformat\output\activitybadge::$content = null |
|
protected |
The content to be displayed in the activity badge.
◆ $extraattributes
array core_courseformat\output\activitybadge::$extraattributes = [] |
|
protected |
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'] |
|
protected |
The style for the activity badge.
◆ $url
moodle_url core_courseformat\output\activitybadge::$url = null |
|
protected |
An optional URL to redirect the user when the activity badge is clicked.
◆ STYLES
array const core_courseformat\output\activitybadge::STYLES |
Initial value:= [
'none' => 'badge-none',
'dark' => 'badge-dark',
'danger' => 'badge-danger',
'warning' => 'badge-warning',
'info' => 'badge-info',
]
Badge defined styles.
The documentation for this class was generated from the following file: