silverstripe/sapphire — pull request #204 by halkyon (2012-03-01 10:25:41+00:00)
Title: ENHANCEMENT [file_link id=n] shortcode support for file links in HtmlEditorField

As it says in the commit message, make use of [file_link id=n] shortcodes, instead of hardcoding the location of the file to assets. Mostly works the same way as [sitetree_link id=n] short codes, also adds an ss-broken class to the link if the File record is missing, consistent with SiteTree.

If using the full short code [file_link id=n]my file title[/file_link], it will include data-type and data-size attributes in the returning HTML which include the file's extension and file size respectively, which could be useful to expose to the user.

On a related note, there's a separate issue where shortcodes aren't being inserted via HtmlEditorField.js correctly, spaces are being converted to %20 which the parser doesn't work with. Ticket has been raised here: http://open.silverstripe.org/ticket/6868