Projet

Général

Profil

Paste
Télécharger (4,29 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / file_entity / file_entity.tpl.php @ 66c11afc

1
<?php
2

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

    
73
  <?php print render($title_prefix); ?>
74
  <?php if (!$page): ?>
75
    <h2<?php print $title_attributes; ?>><a href="<?php print $file_url; ?>"><?php print $label; ?></a></h2>
76
  <?php endif; ?>
77
  <?php print render($title_suffix); ?>
78

    
79
  <?php if ($display_submitted): ?>
80
    <div class="submitted">
81
      <?php print $submitted; ?>
82
    </div>
83
  <?php endif; ?>
84

    
85
  <div class="content"<?php print $content_attributes; ?>>
86
    <?php
87
    // We hide the links now so that we can render them later.
88
    hide($content['links']);
89
    // Check to see if the file has an external url for linking.
90
    if(!empty($content['file']['#file']->external_url)) {;?>
91
      <a href="<?php print render($content['file']['#file']->external_url);?>"><?php print render($content);?></a>
92
      <?php
93
    } else {
94
      print render($content);
95
    }
96
    ?>
97
  </div>
98

    
99
  <?php print render($content['links']); ?>
100

    
101
</div>