/** * Export this data so it can be used as the context for a mustache template. * * @param renderer_base $output Renderer base. * @return stdClass */ public function export_for_template(renderer_base $output) { $data = new stdClass(); $data->pagecontextid = $this->pagecontext->id; $data->templates = array(); foreach ($this->templates as $template) { $exporter = new template_exporter($template); $data->templates[] = $exporter->export($output); } $data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(true); $data->navigation = array(); foreach ($this->navigation as $button) { $data->navigation[] = $output->render($button); } $data->canmanage = template::can_manage_context($this->pagecontext); return $data; }