Problem with course format course_header()

Problem with course format course_header()

by Wes Matchett -
Number of replies: 1

I have created a new format and have the headers working, but a surprise.... the header is also displayed when the course Edit Settings page is open. I can't find anything on why this happens or how to prevent, both here and thru google search.

How does one determine when the setting page is being displayed?

I added the header by doing these things. Note that the format name is unit:

in renderer.php I added one function to class format_unit_renderer. This is the workhorse:

public function render_format_unit_toc($obj) { <-- snip irrelevant content that outputs html --> }

and in lib.php two things added:

to class format_unit: public function course_header() { return new format_unit_toc(); }

as a new class: class format_unit_toc implements renderable { <-- snip --> }


Average of ratings: -
In reply to Wes Matchett

Re: Problem with course format course_header()

by Wes Matchett -

Since this needs to go live soon I brought out the dynamite and brute forced the solution.  I added this to the beginning of course_header():

if( basename($_SERVER['PHP_SELF']) == "edit.php" )
    return null;

Does anyone know a better way?