Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/modules/field.views.inc
108 108
  $revision_tables = array();
109 109
  $groups = array();
110 110

  
111
  $group_name = count($field['bundles']) > 1 ? t('Field') : NULL;
111
  // Store translations to avoid being called thousands of times.
112
  $translations['no_value_bracket'] = t('<No value>');
113
  $translations['no_value_dash'] = t('- No value -');
114
  $translations['field'] = t('Field');
115
  $translations['node'] = t('Node');
116
  $translations['content'] = t('Content');
117

  
118
  $group_name = count($field['bundles']) > 1 ? $translations['field'] : NULL;
112 119

  
113 120
  // Build the relationships between the field table and the entity tables.
114 121
  foreach ($field['bundles'] as $entity => $bundles) {
......
116 123
    $groups[$entity] = $entity_info['label'];
117 124

  
118 125
    // Override Node to Content.
119
    if ($groups[$entity] == t('Node')) {
120
      $groups[$entity] = t('Content');
126
    if ($groups[$entity] == $translations['node']) {
127
      $groups[$entity] = $translations['content'];
121 128
    }
122 129

  
123 130
    // If only one bundle use this as the default name.
......
175 182
  // and take the one which is used the most frequently.
176 183
  $field_name = $field['field_name'];
177 184
  list($label, $all_labels) = field_views_field_label($field_name);
185

  
186
  $bundle_names_text = implode(', ', $bundles_names);
187
  $translations['appears_in_help'] = t('Appears in: @bundles.', array('@bundles' => $bundle_names_text));
188
  $translations['delta_appears_in_help'] = t('Delta - Appears in: @bundles.', array('@bundles' => $bundle_names_text));
189
  $translations['language_appears_in_help'] = t('Language - Appears in: @bundles.', array('@bundles' => $bundle_names_text));
190
  $translations['group_historical'] = t('@group (historical data)', array('@group' => $group_name));
191
  $translations['alias_help'] = t('This is an alias of @group: @field.', array('@group' => $group_name, '@field' => $label));
192
  $translations['label_short_language'] = t('@label:language', array('@label' => $label));
193

  
178 194
  foreach ($tables as $type => $table) {
179 195
    if ($type == FIELD_LOAD_CURRENT) {
180 196
      $group = $group_name;
......
182 198
      $column = $field['field_name'];
183 199
    }
184 200
    else {
185
      $group = t('@group (historical data)', array('@group' => $group_name));
201
      $group = $translations['group_historical'];
186 202
      $old_column = 'revision_id';
187 203
      $column = $field['field_name'] . '-' . $old_column;
188 204
    }
......
192 208
      'group' => $group,
193 209
      'title' => $label,
194 210
      'title short' => $label,
195
      'help' =>  t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
211
      'help' => $translations['appears_in_help'],
196 212
    );
197 213

  
198 214
    // Go through and create a list of aliases for all possible combinations of
......
207 223
              'base' => $current_tables[$entity_name],
208 224
              'group' => $groups[$entity_name],
209 225
              'title' => $label_name,
210
              'help' => t('This is an alias of @group: @field.', array('@group' => $group_name, '@field' => $label)),
226
              'help' => $translations['alias_help'],
211 227
            );
212 228
          }
213 229
          $also_known[] = t('@group: @field', array('@group' => $groups[$entity_name], '@field' => $label_name));
......
218 234
              'base' => $revision_tables[$entity_name],
219 235
              'group' => t('@group (historical data)', array('@group' => $groups[$entity_name])),
220 236
              'title' => $label_name,
221
              'help' => t('This is an alias of @group: @field.', array('@group' => $group_name, '@field' => $label)),
237
              'help' => $translations['alias_help'],
222 238
            );
223 239
          }
224 240
          $also_known[] = t('@group (historical data): @field', array('@group' => $groups[$entity_name], '@field' => $label_name));
......
250 266
  foreach ($field['columns'] as $column => $attributes) {
251 267
    $allow_sort = TRUE;
252 268

  
253
    // Identify likely filters and arguments for each column based on field type.
269
    // Identify likely filters and arguments for each column based on field
270
    // type.
254 271
    switch ($attributes['type']) {
255 272
      case 'int':
256 273
      case 'mediumint':
......
263 280
        $argument = 'views_handler_argument_numeric';
264 281
        $sort = 'views_handler_sort';
265 282
        break;
283

  
266 284
      case 'text':
267 285
      case 'blob':
268 286
        // It does not make sense to sort by blob or text.
......
274 292
        break;
275 293
    }
276 294

  
277

  
278 295
    if (count($field['columns']) == 1 || $column == 'value') {
279 296
      $title = t('@label (!name)', array('@label' => $label, '!name' => $field['field_name']));
280 297
      // CCK used the first 10 characters of $label. Probably doesn't matter.
......
290 307
        $group = $group_name;
291 308
      }
292 309
      else {
293
        $group = t('@group (historical data)', array('@group' => $group_name));
310
        $group = $translations['group_historical'];
294 311
      }
295 312
      $column_real_name = $field['storage']['details']['sql'][$type][$table][$column];
296 313

  
......
301 318
        'group' => $group,
302 319
        'title' => $title,
303 320
        'title short' => $title_short,
304
        'help' =>  t('Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
321
        'help' => $translations['appears_in_help'],
305 322
      );
306 323

  
307
      // Go through and create a list of aliases for all possible combinations of
308
      // entity type + name.
324
      // Go through and create a list of aliases for all possible combinations
325
      // of entity type + name.
309 326
      $aliases = array();
310 327
      $also_known = array();
311 328
      foreach ($all_labels as $entity_name => $labels) {
312 329
        foreach ($labels as $label_name => $true) {
313 330
          if ($group_name != $groups[$entity_name] || $label != $label_name) {
314 331
            if (count($field['columns']) == 1 || $column == 'value') {
332
              // CCK used the first 10 characters of $label. Probably doesn't
333
              // matter.
315 334
              $alias_title = t('@label (!name)', array('@label' => $label_name, '!name' => $field['field_name']));
316
              // CCK used the first 10 characters of $label. Probably doesn't matter.
317 335
            }
318 336
            else {
319 337
              $alias_title = t('@label (!name:!column)', array('@label' => $label_name, '!name' => $field['field_name'], '!column' => $column));
......
338 356
        'handler' => $argument,
339 357
        'additional fields' => $additional_fields,
340 358
        'field_name' => $field['field_name'],
341
        'empty field name' => t('- No value -'),
359
        'empty field name' => $translations['no_value_dash'],
342 360
      );
343 361
      $data[$table][$column_real_name]['filter'] = array(
344 362
        'field' => $column_real_name,
......
367 385
          'group' => $group,
368 386
          'title' => $title_delta,
369 387
          'title short' => $title_short_delta,
370
          'help' => t('Delta - Appears in: @bundles.', array('@bundles' => implode(', ', $bundles_names))),
388
          'help' => $translations['delta_appears_in_help'],
371 389
        );
372 390
        $data[$table]['delta']['field'] = array(
373 391
          'handler' => 'views_handler_field_numeric',
......
377 395
          'table' => $table,
378 396
          'handler' => 'views_handler_argument_numeric',
379 397
          'additional fields' => $additional_fields,
380
          'empty field name' => t('- No value -'),
398
          'empty field name' => $translations['no_value_dash'],
381 399
          'field_name' => $field['field_name'],
382 400
        );
383 401
        $data[$table]['delta']['filter'] = array(
......
416 434
          'table' => $table,
417 435
          'handler' => 'views_handler_argument_locale_language',
418 436
          'additional fields' => $additional_fields,
419
          'empty field name' => t('<No value>'),
437
          'empty field name' => $translations['no_value_bracket'],
420 438
          'field_name' => $field['field_name'],
421 439
        );
422 440
        $data[$table]['language']['filter'] = array(
......
442 460
}
443 461

  
444 462
/**
445
 * Have a different filter handler for lists. This should allow to select values of the list.
463
 * Have a different filter handler for lists.
464
 *
465
 * This should allow to select values of the list.
446 466
 */
447 467
function list_field_views_data($field) {
448 468
  $data = field_views_field_default_views_data($field);

Formats disponibles : Unified diff