function bundle_inherit_access_gate in Bundle Inherit 7
Prevent user from editing\deleting inherited field instance.
1 string reference to 'bundle_inherit_access_gate'
- bundle_inherit_menu_alter in ./
bundle_inherit.module - Implements hook_menu_alter().
File
- ./
bundle_inherit.module, line 512 - Bundle Inherit module.
Code
function bundle_inherit_access_gate($callback, $arguments, $instance) {
// First check parent restrictions
$access = call_user_func_array($callback, $arguments);
if (false == $access) {
return false;
}
// Check if this field was inherited
$bundle = $instance['bundle'];
$entity_type = $instance['entity_type'];
$field_name = $instance['field_name'];
$parent = bundle_inherit_bundle_get_parent($entity_type, $bundle);
if (!empty($parent)) {
// Check if parent bundle has this field attached
if (field_info_instance($entity_type, $field_name, $parent)) {
return false;
}
}
return true;
}