Skip to content

Instantly share code, notes, and snippets.

@FMCorz
Created September 9, 2020 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FMCorz/9170d4cb0772167fd9096278a105fa43 to your computer and use it in GitHub Desktop.
Save FMCorz/9170d4cb0772167fd9096278a105fa43 to your computer and use it in GitHub Desktop.
Rendering Moodle shortcode in a theme's layout
{{!
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>
<?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