Adding a custom Media type with Media::type('foo', 'application/foo', $options), 2 times, one with $options['conditions'], and the other without conditions, makes the last set one, the only active one.
Media::type('foo', 'application/foo', $options)
I would expect that the both type handlers co-exists, and the $options['conditions'] assertion let Lithium pick one.
Is that a bug or a feature ?
Adding a 'json' Media type with default views paths, and without an 'encode' closure, to write custom json responses (as views).
The conditions could be array('json' => true), to only handle responses for urls like /posts.json.
How to make it work, side by side with the default json type encoder?
A longer description of a use case: https://github.com/mehlah/li3_jbuilder/blob/master/README.md
Sorry, I still don't understand your use case, or why you would want to wire up two 'json' handlers. Setting 'conditions' => true is only useful when two different logical types (i.e. HTML and JSONP) share the same content-type (i.e. text/html), so I don't even think you need it here.
'conditions' => true
For your plugin, the built-in 'json' type configuration should work fine: it will be triggered if a client requests application/json, or if a URL ends in .json.
9 months later, I don't know why I needed that...
'view' => 'lithium\template\View',
'paths' => [
'template' => [
'layout' => false,
'element' => [
'conditions' => ['ajax' => true]
i dont know where is bug but after few yr working this part, li3 starts loading layout. Any suggestion how i can debug this ? any changes in li3 core negotiation ? when i place is('ajax') in controller, li3 return true, why media starts loading layout insted of layout false ? ;/ when i add action.ajax media handle view w/o layout properly !
I believe this is the only recent change to Media... not sure that would affect it though. You're sure it's not something in your own code?
YUP i think this is it ill try li3 b4 this patch and after..