trying to add video to auth instructions, stripping most html, can I override login class method? [3.7.1]

trying to add video to auth instructions, stripping most html, can I override login class method? [3.7.1]

by tim st.clair -
Number of replies: 0
Picture of Plugin developers

In Auth Instructions (administration > plugins > authentication > manage authentication ) there is a moodle editor which allows the entry of some html. it's rendered by a regular old confightmleditor object.

$temp->add(new admin_setting_confightmleditor('auth_instructions', new lang_string('instructions', 'auth'), new lang_string('authinstructions', 'auth'), ''));

When I look at the $context object value in my theme as its rendering the login templateit has stripped some of the html. So it's getting modified earlier than that.

I thought it might be the moodle/site:trustcontent capability. I've enabled the "Enable trusted content" over in site security, then ensured the user had the capability, and edited the content to have various html in it but no luck - it seems any complex html is stripped when rendered. This setting is not being applied to the auth_instructions before it gets calculated for template rendering.

So I hit the code and found that in auth/classes/output/login.php's export_for_template method it performs:

list($data->instructions, $data->instructionsformat) = external_format_text($this->instructions, FORMAT_MOODLE, context_system::instance()->id);

extenral_format_text  has an options paramter, one of which is "trusted" which means the string wont be cleaned. This sounds just like what I need.

So my question is, how can I override the export_for_template method in the core_auth\output\login class here from my theme so that I can make it work the way I want without having to modify core?

Average of ratings: -