Greetings,
Today's problem is that I need to be able to add a Caption field to an uploaded file. Unfortunately, uploaded files aren't included in the list of System Objects in the New Field form, so I need to be able to add an object type and provide some kind of handling for it.
To avoid ugly hacks into Commercial.pack code, the best solution seems to be to write my own plugin and use a callback, but I'm still pretty new to MT and my deadline doesn't allow much time for learning curve. Can somebody with better understanding of custom fields describe how this would work, or at least point me in the right direction so I can ask more succinct and intelligent questions in a few days?
thanks,
Bill
Reported on Movable Type 4.3
Is there a reason not to use the asset's description or title field for a caption? I don't know the specifics of what you're after, but that's the first place I'd go.
I need to provide a way for a user to add their own caption when they upload a file. Here's what I've come up with so far:
1. Added file in addons/Commercial.pack/config.yaml so Asset shows up in System Objects select list in Custom Fields > New Field form:
2. added callbacks in addons/Commercial/config.yaml
3. Added caption input to tmpl/cms/dialog/asset_options.tmpl so Captions field shows up when I'm uploading a file:
4. Added the tag provided by Custom Field to my Entry template
With all of that, the caption field that does show up in the upload file form when I do Create > Upload File in my blog and I can enter a caption. The only thing that isn't happening now is for the caption doesn't show up with my uploaded file. Any ideas what I'm missing, or where my caption goes when I post an upload?
thanks,
Bill
PS--of course, this should probably all go into its own plugin instead of hacks on Commercial.pack and MT, but I need to get something working first.
I will admit to not studying your code, because I'm left going back to myoriginal question: what's wrong with using the asset title or description fields that are included for this very purpose?
It's mostly just that being able to add a caption is a requirement that was presented to me by the people I work for, not something I decided to do on my own. If I just can't get this to work, then it might be time to try to talk them into using the description.
Updating:
Since using Description could make my life a lot easier, I just tried uploading a file and providing a description. Unfortunately, my description didn't show up anywhere either, just like my caption doesn't. Any ideas on that?
cheers,
Bill
Are you publishing the description? I'm guessing not, because it's not done by default. http://www.movabletype.org/documentation/appendices/tags/assetdescription.html You could use Custom Asset Markup (http://plugins.movabletype.org/custom-asset-markup/) to rewrite the markup to include this.