/** * Invoked after a restore operation is run. * * This hook is called after any of the restore operations on the components is * run. * * @param string $op * The operation that is triggered: revert, rebuild, disable, enable * @param array $items * The items handled by the operation. */ function hook_features_post_restore($op, $items) { if ($op == 'rebuild') { // Use features rebuild to rebuild the features independent exports too. entity_defaults_rebuild(); } }
/** * Deletes the entities then rebuilds defaults if needed. * * @param $bids * Can be an array of numeric BIDS, names, or combo as sutiable for load(). */ public function delete($bids) { $transaction = db_transaction(); if (!empty($bids) && ($entities = command_buttons_load_multiple($bids, array()))) { try { foreach ($entities as $bid => $entity) { // Call the entity-specific callback (if any): module_invoke_all('entity_delete', $entity, 'command_button'); field_attach_delete('command_button', $entity); } // Delete after calling hooks so that they can query entity tables as needed. db_delete('command_buttons')->condition('bid', array_keys($entities), 'IN')->execute(); // Clear the page and block and entity_load_multiple caches. entity_get_controller('command_button')->resetCache(); foreach ($entities as $id => $entity) { if (entity_has_status($this->entityType, $entity, ENTITY_IN_CODE)) { entity_defaults_rebuild(array($this->entityType)); break; } } } catch (Exception $e) { $transaction->rollback(); watchdog_exception('command_button', $e); throw $e; } } }