You are here

function view_unpublished_content_type_permissions in view_unpublished 7

Utility function, return a formatted list of content types for use here.

1 call to view_unpublished_content_type_permissions()
view_unpublished_user_perms in ./view_unpublished.module
Utility function that returns the user's view_unpublished permissions in the following format:

File

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

Code

function view_unpublished_content_type_permissions($machine_readable = FALSE) {
  $perms = array();
  foreach (node_permissions_get_configured_types() as $type) {
    $info = node_type_get_type($type);
    $type = check_plain($info->type);
    if ($machine_readable) {
      $perms[$type] = "view any unpublished {$type} content";
    }
    else {
      $perms["view any unpublished {$type} content"] = array(
        'title' => t('%type_name: View any unpublished content', array(
          '%type_name' => $info->name,
        )),
      );
    }
  }
  return $perms;
}