1 file.module file_list_permissions($type)

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

Parameters

$type: The machine-readable name of the file type.

Return value

array: An array of permission names and descriptions.

Related topics

File

core/modules/file/file.module, line 3197
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function file_list_permissions($type) {
  $info = file_type_load($type);

  // Build standard list of file permissions for this type.
  $permissions = array(
    "edit own $type files" => array(
      'title' => t('%type_name: Edit own files', array('%type_name' => $info->name)),
    ),
    "edit any $type files" => array(
      'title' => t('%type_name: Edit any files', array('%type_name' => $info->name)),
    ),
    "delete own $type files" => array(
      'title' => t('%type_name: Delete own files', array('%type_name' => $info->name)),
    ),
    "delete any $type files" => array(
      'title' => t('%type_name: Delete any files', array('%type_name' => $info->name)),
    ),
    "download own $type files" => array(
      'title' => t('%type_name: Download own files', array('%type_name' => $info->name)),
    ),
    "download any $type files" => array(
      'title' => t('%type_name: Download any files', array('%type_name' => $info->name)),
    ),
  );

  return $permissions;
}