Closed sandio closed 8 years ago
@kmotsov can you elaborate on the way such JSON
adapter should render? Can you illustrate with a code a sample usage of the Adapter?
According to me for now it should be a pretty simple adapter.
Some general behaviour as I see it:
Otherwise the adapter should work exactly as a smarty adapter
json.tpl
extension{if $params.orders eq true}
{json from = $customers, fields = ['id', 'name'], item = customer}
{if $item->has_orders}
{json $item->orders, ['id', 'price']}
{/if}
{/json}
{else}
{json from = $customers, fields = ['id', 'name']}{/json}
{/if}
Content-Type
to the value of an instance variable (called for example content_type
) of the adapter that should default to application\json
and should be changeable in the controller's action.Latest version includes rendering module. The JSON adapter can be dispatched to another issue.
Core module for rendering output consisting of: