1 node.api.php hook_node_type_list_permissions($type)

Add to the matrix of node permissions on a node type to be displayed on the node type form. This would be used in addition to hook_permission() which supplies the actual permissions.

This hook is invoked from node_type_form_permissions.

@since 1.34.0 Hook added.

Parameters

string $type: The node type.

Related topics

File

core/modules/node/node.api.php, line 976
Hooks provided by the Node module.

Code

function hook_node_type_list_permissions($type) {
  $perms = array();
  foreach (node_type_get_names() as $node_type => $name) {
    if ($type != $node_type) {
      continue;
    }
    $perms += array(
      "view own $type content" => array(
        'title' => t('%type_name: View own content', array('%type_name' => $name)),
      ),
      "view any $type content" => array(
        'title' => t('%type_name: View any content', array('%type_name' => $name)),
      ),
    );
  }

  return $perms;
}