[MTOS-dev] MT as asset aggregator
Timothy Appnel
tim at appnel.com
Tue Jan 1 18:43:55 PST 2008
As you know I'm prone to bending MT to my will so I'm with you Dan.
There is one annoying condition that makes extending the asset manager
through plugins rather hard though.
MT only creates asset associations with entries and pages by embedding
the right markup in text and more fields. You can of course create an
association in the API, but if the entry/page text or text_more is
changed the MT::Entry object wipes out all of the associations. (Look
at the sync_assets method in MT::Entry.)
So there are a couple of things of note here.
The first is that if you are text formatting engine/plugin that
doesn't allow for HTML markup you can't establish an association. Even
if it generates the markup MT is looking for the sync_assets method is
performed on the contents of the text and text_more fields *before*
being passed through the text formatting engine. Further, if the text
formatting engine inserts an asset with "wrong" type of markup (an
image tag or a cut-and-paste YouTube embed) the association isn't
established either.
The second problem and the one that gets in the way of what I really
want (asset attachments to an entry or page) is that the entry class
presumes that asset associations will only be made through something
like the rich text editor and deletes any association it can't find in
the markup of text and text_more. This makes creating a plugin to do
asset attachments a non-starter. Sure you can hack the internals or
overload it, but
I'd suggest adding an embedded column to MT::ObjectAsset as a Boolean
that would be used by sync_assets to only delete assets that it noted
as being embedded in the text of the entry/page. Any assets that have
embedded=false would remain for a plugin or some other part of the
system to manage. (I'm suggesting embedded instead of attachment
because I believe attachments will become the more common usage.)
The first issue is a bit more tricky whereby I don't have a full
solution to propose. Processing the text after it is passed through
the text formatting engine may be helpful to text engines that don't
permit markup. That still doesn't address text formatting engines or
third party WYSIWYG widgets that don't generate the precise MT markup.
Ideally I'd love to see the attachment functionality built in to the
core of MT because there aren't enough hours in the day to code every
plugin I could use. That may be setting my expectations too high that
I would just settle for the embedded column and the adjusted
sync_assets methods so different plugins and usage scenarios are at
least possible.
<tim/>
On 1/1/08, Dan Wolfgang <dan at danandsherree.com> wrote:
> My feedback is minimal, but here it is: I love all the possibilities
> that have been thought up for how to use the Assets system. I think
> it's the most exciting new feature to come out of MT4 and I'm
> interested to see what it develops into as time goes by. (In
> fact--when I can get some time--I really hope I can get some plugins
> together to do some other things *I* want out of the Assets tool.)
--
Timothy Appnel
Appnel Solutions
http://appnel.com/
More information about the MTOS-dev
mailing list