function publishcontent_permission in Publish Content 7
Implements hook_permission().
1 call to publishcontent_permission()
- publishcontent_og_permission in ./
publishcontent.module - Implements hook_og_permission().
File
- ./
publishcontent.module, line 228 - Add link to publish or unpublish a node, with access control based on the node type
Code
function publishcontent_permission() {
$perms = array(
'publish any content' => array(
'title' => t('Publish any content'),
),
'unpublish any content' => array(
'title' => t('Unpublish any content'),
),
'publish editable content' => array(
'title' => t('Publish editable content'),
),
'unpublish editable content' => array(
'title' => t('Unpublish editable content'),
),
);
foreach (node_type_get_types() as $type) {
// Only show permissions for activated node types.
if (isset($type->type) && variable_get('publishcontent_' . $type->type, FALSE)) {
$perms['publish any ' . $type->type . ' content'] = array(
'title' => t('Publish any @type content', array(
'@type' => $type->name,
)),
);
$perms['publish own ' . $type->type . ' content'] = array(
'title' => t('Publish own @type content', array(
'@type' => $type->name,
)),
);
$perms['publish editable ' . $type->type . ' content'] = array(
'title' => t('Publish editable @type content', array(
'@type' => $type->name,
)),
);
$perms['unpublish any ' . $type->type . ' content'] = array(
'title' => t('Unpublish any @type content', array(
'@type' => $type->name,
)),
);
$perms['unpublish own ' . $type->type . ' content'] = array(
'title' => t('Unpublish own @type content', array(
'@type' => $type->name,
)),
);
$perms['unpublish editable ' . $type->type . ' content'] = array(
'title' => t('Unpublish editable @type content', array(
'@type' => $type->name,
)),
);
}
}
return $perms;
}