General developer forum

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

 
Picture of Michael Milette
Disable auto-linking filter during a call to format_text()/format_string()
Core developersParticularly helpful MoodlersPlugin developers

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

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Disable auto-linking filter during a call to format_text()/format_string()
Core developersDocumentation writersParticularly helpful MoodlersPlugin 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.)

 
Average of ratings: Useful (2)
Picture of Michael Milette
Re: Disable auto-linking filter during a call to format_text()/format_string()
Core developersParticularly helpful MoodlersPlugin developers

Hi Tim,

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

Best regards,

Michael

 
Average of ratings: -
Picture of Michael Milette
Re: Disable auto-linking filter during a call to format_text()/format_string()
Core developersParticularly helpful MoodlersPlugin developers

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

 
Average of ratings: Useful (1)