function brightcove_field_storage_write in Brightcove Video Connect 7.7
Same name and namespace in other branches
- 7.6 brightcove.module \brightcove_field_storage_write()
Implements hook_field_storage_write().
File
- ./
brightcove.module, line 2122 - Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.
Code
function brightcove_field_storage_write($entity_type, $entity, $op, $fields) {
if ($entity_type == 'brightcove_playlist') {
foreach ($fields as $field_id) {
$field = field_info_field_by_id($field_id);
$field_name = $field['field_name'];
if ($field['type'] == 'brightcove_field') {
$videos = field_get_items($entity_type, $entity, $field_name);
$video_ids = [];
foreach ($videos as $video_id) {
$video_ids[] = $video_id['brightcove_id'];
}
$entity->playlist
->setVideoIds($video_ids);
}
}
}
}