public function Box::delete in Boxes 7.2
Override the delete to remove the fields and blocks
Overrides Entity::delete
File
- includes/
boxes.core.inc, line 347 - Box classes and plugin interface
Class
- Box
- The Box entity class
Code
public function delete() {
if ($this
->internalIdentifier()) {
// Delete the field values
field_attach_delete('box', $this);
// Delete any blocks
// @see block_custom_block_delete_submit()
db_delete('block')
->condition('module', 'boxes')
->condition('delta', $this
->identifier())
->execute();
db_delete('block_role')
->condition('module', 'boxes')
->condition('delta', $this
->identifier())
->execute();
// @see node_form_block_custom_block_delete_submit()
db_delete('block_node_type')
->condition('module', 'boxes')
->condition('delta', $this
->identifier())
->execute();
entity_get_controller($this->entityType)
->delete(array(
$this
->internalIdentifier(),
));
}
}