function blockexport_settings_features_revert in Blockexport 7
Same name and namespace in other branches
- 7.2 blockexport.module \blockexport_settings_features_revert()
Implements hook_features_export_revert().
File
- ./
blockexport.module, line 72 - This features component provide developer to export all blocks into a feature.
Code
function blockexport_settings_features_revert($module_name = NULL) {
$mycomponents = features_get_default('blockexport_settings', $module_name);
if (!empty($mycomponents)) {
if (count($mycomponents['block']) > 0) {
db_truncate('block')
->execute();
foreach ($mycomponents['block'] as $mycomponent) {
db_insert('block')
->fields($mycomponent)
->execute();
}
}
if (count($mycomponents['block_custom']) > 0) {
db_truncate('block_custom')
->execute();
foreach ($mycomponents['block_custom'] as $mycomponent_custom) {
db_insert('block_custom')
->fields($mycomponent_custom)
->execute();
}
}
if (count($mycomponents['block_node_type']) > 0) {
db_truncate('block_node_type')
->execute();
foreach ($mycomponents['block_node_type'] as $mycomponent_block_type) {
db_insert('block_node_type')
->fields($mycomponent_block_type)
->execute();
}
}
if (count($mycomponents['block_role']) > 0) {
db_truncate('block_role')
->execute();
foreach ($mycomponents['block_role'] as $mycomponent_block_role) {
db_insert('block_role')
->fields($mycomponent_block_role)
->execute();
}
}
if (isset($mycomponents['block_class']) && count($mycomponents['block_class']) > 0) {
db_truncate('block_class')
->execute();
foreach ($mycomponents['block_class'] as $mycomponent_block_class) {
db_insert('block_class')
->fields($mycomponent_block_class)
->execute();
}
}
}
}