Projet

Général

Profil

Révision b433176d

Ajouté par Assos Assos il y a environ 4 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/colorbox/colorbox.theme.inc
18 18
 *   An HTML string representing the themed output.
19 19
 *
20 20
 * @ingroup themeable
21
 *
22
 * @codingStandardsIgnoreStart
21 23
 */
22 24
function theme_colorbox_image_formatter($variables) {
25
  // @codingStandardsIgnoreEnd
26
  global $language;
23 27
  static $gallery_token = NULL;
24 28
  $item = $variables['item'];
25 29
  $entity_type = $variables['entity_type'];
......
95 99
      break;
96 100

  
97 101
    case 'custom':
98
      $caption = token_replace($settings['colorbox_caption_custom'], array($entity_type => $entity, 'file' => (object) $item), array('clear' => TRUE));
102
      $caption = token_replace($settings['colorbox_caption_custom'], array($entity_type => $entity, 'file' => (object) $item), array('clear' => TRUE, 'language' => $language));
99 103
      break;
100 104

  
101 105
    default:
102 106
      $caption = '';
103 107
  }
104 108

  
105
  // Shorten the caption for the example styles or when caption shortening is active.
109
  // Shorten the caption for the example styles or when caption shortening is
110
  // active.
106 111
  $colorbox_style = variable_get('colorbox_style', 'default');
107 112
  $trim_length = variable_get('colorbox_caption_trim_length', 75);
108 113
  if (((strpos($colorbox_style, 'colorbox/example') !== FALSE) || variable_get('colorbox_caption_trim', 0)) && (drupal_strlen($caption) > $trim_length)) {
......
110 115
  }
111 116

  
112 117
  // Build the gallery id.
113
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
118
  list($id) = entity_extract_ids($entity_type, $entity);
114 119
  $entity_id = !empty($id) ? $entity_type . '-' . $id : 'entity-id';
115 120
  switch ($settings['colorbox_gallery']) {
116 121
    case 'post':
......
126 131
      break;
127 132

  
128 133
    case 'field_page':
129
      $gallery_id = 'gallery-' . $field['field_name'];
134
      $gallery_id = isset($field['field_name']) ? 'gallery-' . $field['field_name'] : 'gallery-page';
130 135
      break;
131 136

  
132 137
    case 'custom':
......
137 142
      $gallery_id = '';
138 143
  }
139 144

  
140
  // If gallery id is not empty add unique per-request token to avoid images being added manually to galleries.
145
  // If gallery id is not empty add unique per-request token to avoid images
146
  // being added manually to galleries.
141 147
  if (!empty($gallery_id) && variable_get('colorbox_unique_token', 1)) {
142
    // Check if gallery token has already been set, we need to reuse the token for the whole request.
148
    // Check if gallery token has already been set, we need to reuse the token
149
    // for the whole request.
143 150
    if (is_null($gallery_token)) {
144 151
      // We use a short token since randomness is not critical.
145 152
      $gallery_token = drupal_random_key(8);
......
154 161
    $path = file_create_url($image['path']);
155 162
  }
156 163

  
157
  return theme('colorbox_imagefield', array('image' => $image, 'path' => $path, 'title' => $caption, 'gid' => $gallery_id));
164
  return theme('colorbox_imagefield', array(
165
    'image' => $image,
166
    'path' => $path,
167
    'title' => $caption,
168
    'gid' => $gallery_id,
169
  ));
158 170
}
159 171

  
160 172
/**
......
171 183
 *   An HTML string containing a link to the given path.
172 184
 *
173 185
 * @ingroup themeable
186
 *
187
 * @codingStandardsIgnoreStart
174 188
 */
175 189
function theme_colorbox_imagefield($variables) {
190
  // @codingStandardsIgnoreEnd
176 191
  $class = array('colorbox');
177 192

  
178 193
  if ($variables['image']['style_name'] == 'hide') {
......
204 219
 * Preprocess variables for the colorbox-insert-image.tpl.php file.
205 220
 *
206 221
 * @param array $variables
222
 *   Array with variables values.
223
 *
224
 * @codingStandardsIgnoreStart
207 225
 */
208 226
function template_preprocess_colorbox_insert_image(&$variables) {
227
  // @codingStandardsIgnoreEnd
209 228
  $item = $variables['item'];
210 229
  $variables['file'] = file_load($item['fid']);
211 230
  $variables['style_name'] = $item['style_name'];

Formats disponibles : Unified diff