function field_kaltura_field_presave in Kaltura 7.2
Same name and namespace in other branches
- 7.3 plugins/field_kaltura/field_kaltura.module \field_kaltura_field_presave()
Implements hook_field_presave().
Update the the node_kaltura table with the entry id before the filed save. Not sure this is needed we have local notifications.
File
- plugins/
field_kaltura/ field_kaltura.module, line 999 - Kaltura as a field primary module file.
Code
function field_kaltura_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
foreach ($items as $item) {
$rec['kaltura_entryid'] = $item['entryid'];
$rec['kaltura_media_type'] = $item['mediatype'];
$query = db_select('node_kaltura', 'k')
->fields('k', array(
'kaltura_entryid',
))
->condition('kaltura_entryid', $item['entryid'], '=')
->execute()
->fetchCol();
if (empty($query)) {
drupal_write_record('node_kaltura', $rec);
}
else {
drupal_write_record('node_kaltura', $rec, 'kaltura_entryid');
}
}
}