fusioneng/Shortcake — pull request #44 by mattheu (2014-11-11 15:17:40+00:00)
Title: Fieldmanager

**NOTE:** This is still in progress.

Integration with fieldnamager to build out fields.

Here's where i'm at so far - and my thoughts on this.

Added fieldnamager firlds for textarea, text and media.

**The good:**

We have a funcitoning fields - including image upload field.

I have made the core code for displaying fields more customisable - allowing developers to specify both a template for each field, and also a custom view object - which can be used to build more complex field types such as media uploader. This means the fieldmanager code can live as a compeltely separate 'plugin'.

The basic fieldmanager fields worked really well just by passing the underscore template placeholders as label, value and ID.

** The Bad**
More complex fields like the media uploader don't really work so well out of the box. Media for example requires a few workarounds to make th JS work correctly, and update the values.

Example 1: select field. We don't have access to options when building the template. So it requries custom JS to add these.

Example 2: media field preview image HTML isn't output in the template because we have no value at this point. I have hacked around this by using ajax to get the image src and replicating the markup required - but its hacky.

My concerns here are we do not get enough benefit from fieldmanager. If custom code is required for each of the more complex fields - is it that much easier than building our own? Basically fieldmanager is PHP and Shortcake is JS and its hacky to mesh the two.

Also by going too far down this route are we making fieldmanager a dependency which would put people off using Shortcake?

Any thoughts?