function commerce_file_menu_alter in Commerce File 7
Same name and namespace in other branches
- 7.2 commerce_file.module \commerce_file_menu_alter()
Implements hook_menu_alter()
- add custom access callback to block deleting of fields on a license, while still allowing updating of the field settings
File
- ./
commerce_file.module, line 113 - Provides integration of file licenses with Commerce
Code
function commerce_file_menu_alter(&$items) {
$path = 'admin/commerce/config/file-licenses';
$field_position = count(explode('/', $path)) + 1;
// add custom access callback for field delete on licenses
if (isset($items["{$path}/fields/%field_ui_menu/delete"])) {
$items["{$path}/fields/%field_ui_menu/delete"]['access callback'] = 'commerce_file_license_field_config_delete_access';
$items["{$path}/fields/%field_ui_menu/delete"]['access arguments'] = array(
'administer ' . COMMERCE_FILE_LICENSE_ENTITY_NAME,
$field_position,
);
}
}