file_token_info()
Implements hook_token_info().
File
- core/modules/file/file.module, line 1041
- Defines a "managed_file" Form API field and a "file" field for Field module.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | function file_token_info() { $types [ 'file' ] = array ( 'name' => t( "Files" ), 'description' => t( "Tokens related to uploaded files." ), 'needs-data' => 'file' , ); // File related tokens. $file [ 'fid' ] = array ( 'name' => t( "File ID" ), 'description' => t( "The unique ID of the uploaded file." ), ); $file [ 'name' ] = array ( 'name' => t( "File name" ), 'description' => t( "The name of the file on disk." ), ); $file [ 'path' ] = array ( 'name' => t( "Path" ), 'description' => t( "The location of the file relative to Drupal root." ), ); $file [ 'mime' ] = array ( 'name' => t( "MIME type" ), 'description' => t( "The MIME type of the file." ), ); $file [ 'size' ] = array ( 'name' => t( "File size" ), 'description' => t( "The size of the file." ), ); $file [ 'url' ] = array ( 'name' => t( "URL" ), 'description' => t( "The web-accessible URL for the file." ), ); $file [ 'created' ] = array ( 'name' => t( "Created" ), 'description' => t( "The date the file created." ), 'type' => 'date' , ); $file [ 'changed' ] = array ( 'name' => t( "Changed" ), 'description' => t( "The date the file was most recently changed." ), 'type' => 'date' , ); $file [ 'owner' ] = array ( 'name' => t( "Owner" ), 'description' => t( "The user who originally uploaded the file." ), 'type' => 'user' , ); return array ( 'types' => $types , 'tokens' => array ( 'file' => $file , ), ); } |
Please login to continue.