Jump to content

Attachments: more flexibility, please?


Recommended Posts

One of my clients has requested that attachments (to editor content) be displayed slightly differently. He wants me to set up a separate box with the text "Related Files:" and then thumbnails for each file.

It seems that the attachment display is hard-coded into \IPS\Helpers\Form\Editor and that it is actually stored in the DB with the content. The storage part is fine... except that there is no way for me to specify a custom template for my attachments. I also don't see an easy way for me to hook into this without overwriting most of the getValue() method.

It would be great if we could specify a template in our EditorLocations extension, or even better, to format the attachments as we see fit.

So, to summarize, I'm thinking:

  • An optional method in the EditorLocations extension (e.g. attachmentDisplay( $attachments ) )
  • In \IPS\Helpers\Form\Editor::getValue(), check if the attachmentDisplay method exists
  • If the method exists, call it. The method should return the formatted content that would be stored in the database
  • If the method does not exist, use the current logic that loops through all attachments

Is this possible, and if so, how soon could it be implemented (just so I can set expectations)?


Link to comment
Share on other sites

Ping @Mark @bfarber. Would really appreciate it if someone could at least take a look at this and tell me "yes, we'll do this, maybe by version ___" or "too bad, figure something out yourself". If this isn't going to be implemented in the near future, I'll need to do some refactoring here, so the sooner I can get a response, the better.


Link to comment
Share on other sites

3 hours ago, bfarber said:

I don't hate the idea but I also haven't researched it yet.  It's something we can probably look into, but won't likely be for the next release.

Thanks. I would appreciate it though if it could at least be put onto whatever "sooner-rather-than-later" list you have. :) 

In the meantime I think I'll be removing attachments from the editor field and putting them into a separate upload field for "related files". I'm not thrilled with it, but I don't see any other easy way to do it.

Link to comment
Share on other sites

  • 2 weeks later...


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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