Disable auto-linking filter during a call to format_text()/format_string()

Disable auto-linking filter during a call to format_text()/format_string()

av Michael Milette -
Antall svar: 3
Bilde av Core developers Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers Bilde av Testers Bilde av Translators

Hi Moodle developers,

I was wondering if someone might be able to suggest a way to temporarily disable the auto-linking filters while I make my own calls to format_string() or format_text().

In particular, I would like to accomplish is to temporarily disable the auto-linking plugin including Activity names, Glossary and Database auto-linking filters as these find strings and turns them into links which is undesirable in my case since I am doing the same. However, I don't want to turn off these globally in case people actually want to use these, just for one or two calls to the format_....() functions.

I am attempting to do this from within a theme where I have full control of the source code.

Any suggestions?

Best regards,

Michael

Gjennomsnittlig vurdering: -
Som svar til Michael Milette

Re: Disable auto-linking filter during a call to format_text()/format_string()

av Tim Hunt -
Bilde av Core developers Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Peer reviewers Bilde av Plugin developers

This is possible in recent Moodle versions. See MDL-50491 which I implemented because we needed this at the OU.

(Oops! just noticed that still has the dev docs required tag. However, I think the PHPdocs I wrote in the code are pretty good.)

Gjennomsnittlig vurdering:Useful (2)
Som svar til Tim Hunt

Re: Disable auto-linking filter during a call to format_text()/format_string()

av Michael Milette -
Bilde av Core developers Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers Bilde av Testers Bilde av Translators

Hi Tim,

Thank you very much. Sound exactly like what I need. Can't wait to try it out.

Best regards,

Michael

Som svar til Tim Hunt

Re: Disable auto-linking filter during a call to format_text()/format_string()

av Michael Milette -
Bilde av Core developers Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Plugin developers Bilde av Testers Bilde av Translators

Hey Tim,

Just wanted to thank you again. I implemented your suggestion and it worked out perfectly. Thank you so much for putting in the effort to add support for this feature in Moodle core.

Have a great weekend!

Michael

Gjennomsnittlig vurdering:Useful (1)