function entity_embed_embed_button_delete in Entity Embed 7.2
Same name and namespace in other branches
- 7.3 entity_embed.module \entity_embed_embed_button_delete()
- 7 entity_embed.module \entity_embed_embed_button_delete()
Deletes an embed button object from the database.
Parameters
$embed_button: The embed button to delete or the button cid.
1 call to entity_embed_embed_button_delete()
- IconFileUsageTest::testEmbedButtonIcon in ./
entity_embed.test - Tests the embed_button and file usage integration.
1 string reference to 'entity_embed_embed_button_delete'
- entity_embed_schema in ./
entity_embed.install - Implements hook_schema().
File
- ./
entity_embed.module, line 255 - Provides a CKEditor plugin and text filter for embedding and rendering entities.
Code
function entity_embed_embed_button_delete($embed_button) {
ctools_include('export');
$button_icon_fid = $embed_button->button_icon_fid;
// Remove file usage from the associated button icon.
if ($button_icon_fid) {
if ($file = file_load($button_icon_fid)) {
// Mark the file as temporary since it is no longer needed.
if ($file->status !== 0) {
$file->status = 0;
file_save($file);
}
file_usage_delete($file, 'entity_embed', $embed_button->name, 1);
}
}
$value = is_object($embed_button) ? $embed_button->cid : $embed_button;
db_delete('entity_embed')
->condition('cid', $value)
->execute();
}