This may be a problem with media module, but since commit 497dd75a81f544a0c67fc2c658b518f55756fc56, views pulling a multimedia asset field (from media module) cause a fatal error about using an object as an array. It's trying to access $item['raw'][$id] but $item['raw'] is an object, though I don't know enough to say that this is a fault of how media module is implementing its field api hooks. Changing it to $item['raw']->$id produces various "undefined index" errors.
Reverting the change from the above commit solves the problem, but this change was obviously made for a reason so I'm not sure how best to patch it.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 1127804-field-handler-error-8.patch | 2.72 KB | katbailey |
| #4 | 1127804-field-handler-error.patch | 814 bytes | dawehner |
| #2 | 1127804-field-handler-error.patch | 1.16 KB | katbailey |
Comments
Comment #1
merlinofchaos commentedWhat is $item['raw'] in this case? Typically it's an array from the table, and Views is trying to match the 'columns' to the 'raw' data so that users can use tokens.
I guess my assumption that this would always be the case is clearly false.
Comment #2
katbailey commentedOh what the heck - adding a patch that just reverts the above change purely for my own drush make purposes ;-)
Comment #3
merlinofchaos commentedIf you tell me that it's basically the db fetched as an object and not an array, then a bit of code that tests is_array vs is_object can alleviate that. Cross fingers!
Comment #4
dawehnerMh this is a 1to1 revert of #1109532: Image Field alt/title tokens do not get displayed
This will 100% not work because $item['raw'] will never be a scalar, so the tokens will not work.
raw can be everything. For example and stdClass, a real object or an array where for example 'value' exist.
So we really have to look at it, here is a patch.
Comment #5
katbailey commentedYes, works for me - thanks!
Comment #6
dawehnerOkay what about use ['raw']->{$id} if it's an object.
Comment #7
katbailey commentedHmm, well the keys of the columns array are fid, title and data, but ['raw']->title and ['raw']->data aren't set so I'm getting undefined property errors. I'll try and re-work the logic and see what I come up with...
Comment #8
katbailey commentedWould this fly? It works for my purposes without errors.
Patch attached
Comment #9
merlinofchaos commentedThat should do it, I think.
Committed, thank you!