You are here

function asset_embed_assetapi in Asset 6

Same name and namespace in other branches
  1. 5 asset_embed/asset_embed.module \asset_embed_assetapi()

File

asset_embed/asset_embed.module, line 228
Asset Embed Module

Code

function asset_embed_assetapi($op = 'list', $asset = null) {
  switch ($op) {
    case 'load':
      if ($asset->type == 'embed') {
        $fields['embed'] = unserialize(db_result(db_query('SELECT data FROM {asset_embed} WHERE aid = %d', $asset->aid)));
        $fields['embed']['provider'] = $asset->extension;
      }
      return $fields;
    case 'insert':
      if ($asset->type == 'embed') {
        db_query("INSERT INTO {asset_embed} (aid, data) VALUES (%d, '%s')", $asset->aid, serialize($asset->embed_data));
      }
      break;
  }
}