function ds_extras_permission in Display Suite 7.2
Same name and namespace in other branches
- 7 modules/ds_extras/ds_extras.module \ds_extras_permission()
Implements hook_permission().
File
- modules/
ds_extras/ ds_extras.module, line 79 - Display Suite extras main functions.
Code
function ds_extras_permission() {
$permissions = array();
// Extra check to make sure this doesn't get fired on install.
if (variable_get('ds_extras_switch_view_mode', FALSE)) {
foreach (node_type_get_names() as $key => $name) {
$permissions['ds_switch ' . $key] = array(
'title' => t('Switch view modes on :type', array(
':type' => $name,
)),
);
}
}
if (variable_get('ds_extras_field_permissions', FALSE)) {
$entities = entity_get_info();
foreach ($entities as $entity_type => $info) {
$fields = ds_get_fields($entity_type);
foreach ($fields as $key => $finfo) {
$permissions['view ' . $key . ' on ' . $entity_type] = array(
'title' => t('View !field on !entity_type', array(
'!field' => $finfo['title'],
'!entity_type' => $info['label'],
)),
);
}
}
}
return $permissions;
}