node_list_permissions

Versions
7
node_list_permissions($type)

Helper function to generate standard node permission list for a given type.

Parameters

$type The machine-readable name of the node type.

Return value

array An array of permission names and descriptions.

Related topics

Code

modules/node/node.module, line 2524

<?php
function node_list_permissions($type) {
  $info = node_type_get_type($type);
  $type = check_plain($info->type);

  // Build standard list of node permissions for this type.
  $perms = array(
    "create $type content" => array(
      'title' => t('Create %type_name content', array('%type_name' => $info->name)),
      'description' => t('Create new %type_name content.', array('%type_name' => $info->name)),
    ),
    "edit own $type content" => array(
      'title' => t('Edit own %type_name content', array('%type_name' => $info->name)),
      'description' => t('Edit %type_name content created by the user.', array('%type_name' => $info->name)),
    ),
    "edit any $type content" => array(
      'title' => t('Edit any %type_name content', array('%type_name' => $info->name)),
      'description' => t('Edit any %type_name content, regardless of its author.', array('%type_name' => $info->name)),
    ),
    "delete own $type content" => array(
      'title' => t('Delete own %type_name content', array('%type_name' => $info->name)),
      'description' => t('Delete %type_name content created by the user.', array('%type_name' => $info->name)),
    ),
    "delete any $type content" => array(
      'title' => t('Delete any %type_name content', array('%type_name' => $info->name)),
      'description' => t('Delete any %type_name content, regardless of its author.', array('%type_name' => $info->name)),
    ),
  );

  return $perms;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.