function node_list_permissions

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

1 call to node_list_permissions()
node_permission in modules/node/node.module
Implements hook_permission().

File

modules/node/node.module, line 3142

Code

function node_list_permissions($type) {
    $info = node_type_get_type($type);
    // Build standard list of node permissions for this type.
    $perms = array(
        "create {$type} content" => array(
            'title' => t('%type_name: Create new content', array(
                '%type_name' => $info->name,
            )),
        ),
        "edit own {$type} content" => array(
            'title' => t('%type_name: Edit own content', array(
                '%type_name' => $info->name,
            )),
        ),
        "edit any {$type} content" => array(
            'title' => t('%type_name: Edit any content', array(
                '%type_name' => $info->name,
            )),
        ),
        "delete own {$type} content" => array(
            'title' => t('%type_name: Delete own content', array(
                '%type_name' => $info->name,
            )),
        ),
        "delete any {$type} content" => array(
            'title' => t('%type_name: Delete any content', array(
                '%type_name' => $info->name,
            )),
        ),
    );
    return $perms;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.