You are here

function emapi_media_save in Embedded Media Field 6.3

Save a media object to the database.

Parameters

object &$media: The media object to save.

2 calls to emapi_media_save()
emapi_parse_json in emapi/includes/emapi.parse.inc
Callback for /emapi/parse/json.
emfield_field in ./emfield.module
Implementation of hook_field().

File

emapi/emapi.module, line 348
Provides an API for parsing, storage, and display of third party media.

Code

function emapi_media_save(&$media) {
  module_invoke_all('emapi_media_presave', $media);
  if ($media->emid) {
    drupal_write_record('emapi_media', $media, 'emid');
    module_invoke_all('emapi_media_update', $media);
  }
  else {
    if ($media) {
      drupal_write_record('emapi_media', $media);
      module_invoke_all('emapi_media_insert', $media);
    }
  }
}