Jump to content

HTML in File/Image descriptions


interrobang
 Share

Recommended Posts

I need to use some simple html-tags like <b> in file descriptions but they get stripped after save. Is there some option to allow html in file/image descriptions?

In my case its sufficient to enter the html-tags by hand, but would it be possible to use tinymce for editing the description?

I know I can use repeaters as an alternative, I just love the multi-file upload of the file-fieldtype so much..

Link to comment
Share on other sites

I recommend using either Textile or Markdown if you need to support this type of stuff in your image/file descriptions. For instance, in Markdown you would make bold text **like this**

You'll need to run your image/file descriptions through Textile or Markdown before outputting them. So can do that like this. I'll use Markdown in this example since the module is already in the core.

$markdown = $modules->get('TextformatterMarkdownExtra');
$description = $page->image->description; // your image description
$markdown->format($description); 
echo "<p><img src='{$page->image->url}' alt='' /> $description</p>";

We'll likely add internal support for these Textformatters for image/file descriptions in the near future, so that you don't have to do the above if you don't want to.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...