function publish_button_permission in Publish button 7
Implements hook_permission().
File
- ./
publish_button.module, line 173 - Functions to create a publish button. Real simple, but could be needed.
Code
function publish_button_permission() {
$perms = array(
'publish button publish any content types' => array(
'title' => t('Publish any content types'),
),
'publish button unpublish any content types' => array(
'title' => t('Unpublish any content types'),
),
);
foreach (node_type_get_types() as $type) {
// First we need to check if there are a publish button for the content
// type.
if (variable_get('publish_button_content_type_' . $type->type, FALSE)) {
// And if there is, go through the content types that have the button
// and create permissions for them.
if (isset($type->type)) {
$perms['publish button publish any ' . $type->type] = array(
'title' => t('@type: Publish any', array(
'@type' => $type->name,
)),
);
$perms['publish button publish own ' . $type->type] = array(
'title' => t('@type: Publish own', array(
'@type' => $type->name,
)),
);
$perms['publish button unpublish any ' . $type->type] = array(
'title' => t('@type: Unpublish any', array(
'@type' => $type->name,
)),
);
$perms['publish button unpublish own ' . $type->type] = array(
'title' => t('@type: Unpublish own', array(
'@type' => $type->name,
)),
);
}
}
}
return $perms;
}