Created
September 9, 2020 08:06
-
-
Save FMCorz/9170d4cb0772167fd9096278a105fa43 to your computer and use it in GitHub Desktop.
Rendering Moodle shortcode in a theme's layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{! | |
This represents a theme's layout template. | |
To render the shortcode, simply call the renderer method defined in the renderer. | |
}} | |
<div> | |
{{{ output.block_xp_progress_bar }}} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Your theme's overridden core_renderer file. | |
// | |
// The one below is the renderer from Boost located in | |
// theme/boost/classes/output/core_renderer.php. | |
// You must adapt this in accordance to your theme. | |
namespace theme_boost\output; | |
defined('MOODLE_INTERNAL') || die; | |
/** | |
* Overridden core_renderer. | |
*/ | |
class core_renderer extends \core_renderer { | |
/** | |
* Render shortcode 'xpprogressbar'. | |
*/ | |
public function block_xp_progress_bar() { | |
return format_text('[xpprogressbar]'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment