How to find the HTML generated by the echo line $OUTPUT->course_content_header();

Asked

Viewed 235 times

0

I am modifying a theme from Moodle, however I can’t find some HTML files or at least understand how they are created via backend, I have the following code:

<?php
            echo $OUTPUT->course_content_header();
            echo $OUTPUT->main_content();
            echo $OUTPUT->course_content_footer();
?>

I need to add an element inside the html that one of these lines of code generates, how do I find out in Moodle how it generates this html and how to add this component where I want it.

inserir a descrição da imagem aqui

I want to add an HTML component inside the block Visão Geral dos Cursos, just above the text Nenhuma informação disponível sobre o curso

  • 1

    This is in lib/outputrenderers.php More details on https://moodle.org/mod/forum/discuss.php?d=328350#p1320808

1 answer

1

Enter the following code: var_dump($OUTPUT->course_content_header()); die; to see the $OUTPUT collection output.

Follows the content of the method cited:

public function course_content_header($onlyifnotcalledbefore = false) { global $CFG; if ($this->page->course->id == SITEID) { // return immediately and do not include /course/lib.php if not necessary return ''; } static $functioncalled = false; if ($functioncalled && $onlyifnotcalledbefore) { // we have already output the content header return ''; } require_once($CFG->dirroot.'/course/lib.php'); $functioncalled = true; $courseformat = course_get_format($this->page->course); if (($obj = $courseformat->course_content_header()) !== null) { return html_writer::div($courseformat->get_renderer($this->page)->render($obj), 'course-content-header'); } return ''; }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.