Custom HTML in moodle core page

Custom HTML in moodle core page

by Thanos Aggelakopoulos -
Number of replies: 2

Hello developers,

As you can see in the title, for a plugin im developing, i want to add custom html(a button probably)  in Moodle's grade report page for each course !
From what i've seen i can add custom htlp by using the xxx_before_footer() hook to add html and chose the page with an if($PAGE-->....) statement so it only renders in the page i want.This works fine 
but i wanted to ask if there is a better way to do this. Also i tried some hooks i found like the xxx_grade_report_grader_xx(course,page,context) but they didnt work.
Any suggestions ?

Thank you a lot in advance

Average of ratings: -
In reply to Thanos Aggelakopoulos

Re: Custom HTML in moodle core page

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The supported way to modify core pages is through renderer or template overrides in a theme plugin. No other plugin type is able to do this. As you have identified there are some hooks and callbacks that can be used to insert content into other pages, but doing it this way is a bit of a hack and there's no guarantee that some other plugin isn't going to interfere with the changes you're trying to make.

In reply to Thanos Aggelakopoulos

Re: Custom HTML in moodle core page

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Hi,

I was going to point you in the direction of Custom Scripts (https://docs.moodle.org/dev/customscripts) but it may be that even though the functionality has been around since M1.6 - support may no longer be available in later Moodle versions. I only found out about it when writing my book.