Projet

Général

Profil

Révision 91f42c9e

Ajouté par Assos Assos il y a presque 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/colorbox/colorbox.module
44 44
        'node' => NULL,  // Left for legacy support.
45 45
        'field' => array(),
46 46
        'display_settings' => array(),
47
        'delta' => null,
47 48
      ),
48 49
      'file' => 'colorbox.theme.inc',
49 50
    ),
......
256 257
      'field types' => array('image'),
257 258
      'settings' => array(
258 259
        'colorbox_node_style' => '',
260
        'colorbox_node_style_first' => '',
259 261
        'colorbox_image_style' => '',
260 262
        'colorbox_gallery' => 'post',
261 263
        'colorbox_gallery_custom' => '',
......
285 287
    '#options' => $image_styles_hide,
286 288
    '#description' => t('Image style to use in the content.'),
287 289
  );
290
  $element['colorbox_node_style_first'] = array(
291
    '#title' => t('Content image style for first image'),
292
    '#type' => 'select',
293
    '#default_value' => $settings['colorbox_node_style_first'],
294
    '#empty_option' => t('No special style.'),
295
    '#options' => $image_styles,
296
    '#description' => t('Image style to use in the content for the first image.'),
297
  );
288 298
  $element['colorbox_image_style'] = array(
289 299
    '#title' => t('Colorbox image style'),
290 300
    '#type' => 'select',
......
386 396
 * Validate function for colorbox_gallery_custom.
387 397
 */
388 398
function colorbox_gallery_custom_validate($element, &$form_state) {
389
  if ($element['#value'] != drupal_html_class($element['#value'])) {
399
  if ($form_state['values']['fields']['field_image']['settings_edit_form']['settings']['colorbox_gallery'] == 'custom' && !preg_match('!^[a-z0-9_-]+$!', $element['#value'])) {
390 400
    form_error($element, t('%name must only contain lowercase letters, numbers, hyphen and underscores.', array('%name' => $element['#title'])));
391 401
  }
392 402
}
......
415 425
    $summary[] = t('Content image style: Original image');
416 426
  }
417 427

  
428
  if (isset($image_styles[$settings['colorbox_node_style_first']])) {
429
    $summary[] = t('Content image style of first image: @style', array('@style' => $image_styles[$settings['colorbox_node_style_first']]));
430
  }
431

  
418 432
  if (isset($image_styles[$settings['colorbox_image_style']])) {
419 433
    $summary[] = t('Colorbox image style: @style', array('@style' => $image_styles[$settings['colorbox_image_style']]));
420 434
  }
......
466 480
        '#node' => $entity, // Left for legacy support.
467 481
        '#field' => $field,
468 482
        '#display_settings' => $display['settings'],
483
        '#delta' => $delta,
469 484
      );
470 485
    }
471 486
  }
......
479 494
function colorbox_insert_styles() {
480 495
  $insert_styles = array();
481 496
  foreach (image_styles() as $key => $style) {
482
    $insert_styles['colorbox__' . $key] = array('label' => t('Colorbox @style', array('@style' => $style['name'])));
497
    $label = isset($style['label']) ? $style['label'] : $style['name'];
498
    $insert_styles['colorbox__' . $key] = array('label' => t('Colorbox @style', array('@style' => $label)));
483 499
  }
484 500

  
485 501
  return $insert_styles;

Formats disponibles : Unified diff