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

  1. create a content type called "test"
  2. add it a video_embed_field field called "field_video"
  3. execute the following code
    $node = new stdClass();
    $node->type = 'test';
    $wrapper = entity_metadata_wrapper('node', $node);
    $wrapper->field_video->set(array('url' => ''));

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)

Members fund testing for the Drupal project. Drupal Association Learn more


DuaelFr’s picture

Assigned: DuaelFr » Unassigned
Status: Active » Needs review
1 KB

This patch is part of the #1day1patch initiative.

muschpusch’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good and works fine!

joekrukosky’s picture

Status: Reviewed & tested by the community » Needs review
1.8 KB

Here is another patch that takes DuaelFr's patch one step further and adds support for video embed's additional field properties.

DuaelFr’s picture

I merged #1 and #3 into a new patch because #3 was not usable alone. (Refactored a bit to avoid code duplication)

plopesc’s picture

Status: Needs review » Fixed

Patch in #4 committed with some minor modifications 507075a

Thank you very much!


DuaelFr’s picture

Thanks for the authoring \o/

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.