You are here

function view_unpublished_permission in view_unpublished 7

Implements hook_permission().

File

./view_unpublished.module, line 11
Main functions and hook implementations of the View Unpublished module.

Code

function view_unpublished_permission() {
  $perms = array(
    'view any unpublished content' => array(
      'title' => t('View any unpublished content'),
    ),
  );

  // Generate standard node permissions for all applicable node types.
  foreach (node_permissions_get_configured_types() as $type) {
    $info = node_type_get_type($type);
    $type = check_plain($info->type);
    $perms["view any unpublished {$type} content"] = array(
      'title' => t('%type_name: View any unpublished content', array(
        '%type_name' => $info->name,
      )),
    );
  }
  return $perms;
}