You are here

function publishcontent_perm in Publish Content 6

Same name and namespace in other branches
  1. 5.2 publishcontent.module \publishcontent_perm()
  2. 5 publishcontent.module \publishcontent_perm()

Implements hook_perm().

File

./publishcontent.module, line 129
Add button to publish or unpublish a node, with access control based on the node type

Code

function publishcontent_perm() {
  $perms = array(
    'publish any content',
    'unpublish any content',
    'publish own content',
    'unpublish own content',
    'publish editable content',
    'unpublish editable content',
  );
  foreach (node_get_types() as $type) {
    if (isset($type->type)) {
      $perms[] = 'publish any ' . check_plain($type->type) . ' content';
      $perms[] = 'publish editable ' . check_plain($type->type) . ' content';
      $perms[] = 'publish own ' . check_plain($type->type) . ' content';
      $perms[] = 'unpublish any ' . check_plain($type->type) . ' content';
      $perms[] = 'unpublish editable ' . check_plain($type->type) . ' content';
      $perms[] = 'unpublish own ' . check_plain($type->type) . ' content';
    }
  }
  return $perms;
}