You are here

function emapi_media_delete in Embedded Media Field 6.3

Delete a media object from the database.

Parameters

integer $emid: The unique identifier of the media to delete.

File

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

Code

function emapi_media_delete($emid) {
  $media =& emapi_static('emapi_media', array());
  $item = emapi_media_load($emid);
  if ($item) {
    unset($media[$emid]);
    db_query("DELETE FROM {emapi_media} WHERE emid = %d", $emid);
    module_invoke_all('emapi_media_delete', $item);
    $link = l($item
      ->get_uri(), $item
      ->url());
    $class = emapi_get_provider_classes(emapi_uri_scheme($item
      ->get_uri()));
    watchdog('emapi', '@provider: deleted !link.', array(
      '@provider' => $class['name'],
      '!link' => $link,
    ));
    drupal_set_message(t('@provider !link has been deleted.', array(
      '@provider' => $class['name'],
      '!link' => $link,
    )));
  }
}