Problem
Currently, we cannot use the very handy entity_metadata_wrapper with a field provided by video_embed_field.
It leads to an error message : "Unknown data property [field name]."
Steps to reproduce
- create a content type called "test"
- add it a video_embed_field field called "field_video"
- execute the following code
$node = new stdClass(); $node->type = 'test'; $wrapper = entity_metadata_wrapper('node', $node); $wrapper->field_video->set(array('url' => 'http://youtu.be/9bZkp7q19f0')); $wrapper->save();
Proposed solution
Add a property callback in hook_field_info to set the field type's property type.
Note : avoid to add a dependency on the entity API module.
(Patch coming)
Comments
Comment #1
duaelfrThis patch is part of the #1day1patch initiative.
Comment #2
muschpusch commentedPatch looks good and works fine!
Comment #3
joekrukoskyHere is another patch that takes DuaelFr's patch one step further and adds support for video embed's additional field properties.
Comment #4
duaelfrI merged #1 and #3 into a new patch because #3 was not usable alone. (Refactored a bit to avoid code duplication)
Comment #5
plopescPatch in #4 committed with some minor modifications 507075a
Thank you very much!
Regards.
Comment #6
duaelfrThanks for the authoring \o/