file_entity.tpl.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * @file
  4. * Default theme implementation to display a file.
  5. *
  6. * Available variables:
  7. * - $label: the (sanitized) file name of the file.
  8. * - $content: An array of file items. Use render($content) to print them all,
  9. * or print a subset such as render($content['field_example']). Use
  10. * hide($content['field_example']) to temporarily suppress the printing of a
  11. * given element.
  12. * - $user_picture: The file owner's picture from user-picture.tpl.php.
  13. * - $date: Formatted added date. Preprocess functions can reformat it by
  14. * calling format_date() with the desired parameters on the $timestamp
  15. * variable.
  16. * - $name: Themed username of file owner output from theme_username().
  17. * - $file_url: Direct URL of the current file.
  18. * - $display_submitted: Whether submission information should be displayed.
  19. * - $submitted: Submission information created from $name and $date during
  20. * template_preprocess_file().
  21. * - $classes: String of classes that can be used to style contextually through
  22. * CSS. It can be manipulated through the variable $classes_array from
  23. * preprocess functions. The default values can be one or more of the
  24. * following:
  25. * - file-entity: The current template type, i.e., "theming hook".
  26. * - file-[type]: The current file type. For example, if the file is a
  27. * "Image" file it would result in "file-image". Note that the machine
  28. * name will often be in a short form of the human readable label.
  29. * - file-[mimetype]: The current file's MIME type. For exampe, if the file
  30. * is a PNG image, it would result in "file-image-png"
  31. * - $title_prefix (array): An array containing additional output populated by
  32. * modules, intended to be displayed in front of the main title tag that
  33. * appears in the template.
  34. * - $title_suffix (array): An array containing additional output populated by
  35. * modules, intended to be displayed after the main title tag that appears in
  36. * the template.
  37. *
  38. * Other variables:
  39. * - $file: Full file object. Contains data that may not be safe.
  40. * - $type: File type, i.e. image, audio, video, etc.
  41. * - $uid: User ID of the file owner.
  42. * - $timestamp: Time the file was added formatted in Unix timestamp.
  43. * - $classes_array: Array of html class attribute values. It is flattened
  44. * into a string within the variable $classes.
  45. * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
  46. * listings.
  47. * - $id: Position of the file. Increments each time it's output.
  48. *
  49. * File status variables:
  50. * - $view_mode: View mode, e.g. 'default', 'full', etc.
  51. * - $page: Flag for the full page state.
  52. * - $is_front: Flags true when presented in the front page.
  53. * - $logged_in: Flags true when the current user is a logged-in member.
  54. * - $is_admin: Flags true when the current user is an administrator.
  55. *
  56. * Field variables: for each field instance attached to the file a corresponding
  57. * variable is defined, e.g. $file->caption becomes $caption. When needing to
  58. * access a field's raw values, developers/themers are strongly encouraged to
  59. * use these variables. Otherwise they will have to explicitly specify the
  60. * desired field language, e.g. $file->caption['en'], thus overriding any
  61. * language negotiation rule that was previously applied.
  62. *
  63. * @see template_preprocess()
  64. * @see template_preprocess_file()
  65. * @see template_process()
  66. */
  67. ?>
  68. <div id="file-<?php print $file->fid ?>" class="<?php print $classes ?>"<?php print $attributes; ?>>
  69. <?php if (!$page): ?>
  70. <?php print render($title_prefix); ?>
  71. <h2<?php print $title_attributes; ?>><a href="<?php print $file_url; ?>"><?php print $label; ?></a></h2>
  72. <?php print render($title_suffix); ?>
  73. <?php endif; ?>
  74. <?php if ($display_submitted): ?>
  75. <div class="submitted">
  76. <?php print $submitted; ?>
  77. </div>
  78. <?php endif; ?>
  79. <div class="content"<?php print $content_attributes; ?>>
  80. <?php
  81. // We hide the links now so that we can render them later.
  82. hide($content['links']);
  83. print render($content);
  84. ?>
  85. </div>
  86. <?php print render($content['links']); ?>
  87. </div>