function field_permissions_uninstall in Field Permissions 7
Same name and namespace in other branches
- 6 field_permissions.install \field_permissions_uninstall()
Implements hook_uninstall().
File
- ./
field_permissions.install, line 22 - Install, update and uninstall functions for the Field Permissions module.
Code
function field_permissions_uninstall() {
// Collect all the field data that reference "field_permissions", within
// the field_config table.
//
$records = db_query("SELECT * FROM {field_config} WHERE data LIKE '%field_permissions%'");
foreach ($records as $record) {
$data = $record->data;
$data = unserialize($data);
unset($data['field_permissions']);
$data = serialize($data);
// Update the record.
db_query("UPDATE {field_config} SET data = :data WHERE id = :id", array(
':data' => $data,
':id' => $record->id,
));
}
}