What is {!} for in files/renderer.php?

What is {!} for in files/renderer.php?

by David Scotson -
Number of replies: 3

I'm looking at the renderers for the file-picker and manager and something has confused me.

In files/renderer.php there is the HTML for most of the pop-ups that you navigate when uploading and managing files in the file-picker. In this file's HTML most, but not all, of the class names have {!} inserted before them, e.g.:

<div class="{!}fp-toolbar">

Immediately after the string is initialized with multiple of these "{!}" a regexp is used to strip them back out again.

return preg_replace('/\{\!\}/', '', $rv);

https://github.com/moodle/moodle/blob/master/files/renderer.php#L262

Just one would look like a mistake but 10 or so of them makes me think I'm missing something clever that's happening.

Average of ratings: Useful (1)
In reply to David Scotson

Re: What is {!} for in files/renderer.php?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The way to investigate this sort of question is to use the command git blame. That will show you who last changed each line of the file. You can access this using the Blame link in the gihub interface. https://github.com/moodle/moodle/blame/master/files/renderer.php

We see those changes were introduced by a couple of commits:

23b83009 » marinaglancy
2012-05-03 MDL-31901: FileManager, added i...

0f0d10c5 » barbararamiro
2012-05-16 MDL-31901 filemanager and filep...

I am not sure what we can deduce from that, or from the tracker issue. (I only looked briefly.)

 

In reply to Tim Hunt

Re: What is {!} for in files/renderer.php?

by David Scotson -
I think those changes in that file were actually just moved from repository/renderer.php, where (I think) the were first added a month before that:

https://github.com/moodle/moodle/commit/b5e7b6385e22d09668397765b08008cf411e1862

Still not sure what they're for, but it seems like these things were more "templatey" in the past and there was all sorts of variables inside {CURLY_BRACKETS} which were supposed to be replaced with appropriate values. Maybe just a remnant of that?
Average of ratings: Useful (1)
In reply to David Scotson

Re: What is {!} for in files/renderer.php?

by David Scotson -
FYI: I found out what these mean while discussing a separate issue.

The files are later processed by Javascript. These marking are basically comments. They mean, don't change this classname, as it's looked for later in the javascript.
Average of ratings: Useful (1)