/** * Display intro section. * @param mod_subpage $subpage Module object * @return string Intro HTML or '' if none */ public function render_intro(mod_subpage $subpage) { // Don't output anything if no text, so we don't get styling around // something blank if (!$subpage->has_intro()) { return ''; } // Make fake activity object in required format, and use to format // intro for module with standard function (which handles images etc.) $activity = (object) array('intro' => $subpage->get_intro(), 'introformat' => $subpage->get_intro_format()); $intro = format_module_intro('subpage', $activity, $subpage->get_course_module()->id); // Box styling appears to be consistent with some other modules $intro = html_writer::tag('div', $intro, array('class' => 'generalbox box', 'id' => 'intro')); return $intro; }