Projet

Général

Profil

Révision a1cafe7e

Ajouté par Assos Assos il y a plus de 4 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/field_collection/ctools/relationships/field_collection_from_field.inc
78 78
  if (isset($entity->{$plugin_info['field_name']})) {
79 79

  
80 80
    $items = field_get_items($plugin_info['entity_type'], $entity, $plugin_info['field_name']);
81

  
82
    // Use negative delta to get item from the end.
83
    if ($delta < 0) {
84
      // Add negative pseudo-delta to total amount of items to get the real
85
      // delta. Example (field_collection with 5 elements): count() == 5:
86
      // 5 + -1 = 4, which would be the last element in this example.
87
      $delta = count($items) + $delta;
88
    }
89

  
81 90
    if (!empty($items) && isset($items[$delta]['value'])) {
82 91
      $field_collection_item = field_collection_item_load($items[$delta]['value']);
83 92
    }
......
98 107
    '#type' => 'textfield',
99 108
    '#title' => t('Delta'),
100 109
    '#size' => 3,
101
    '#description' => t('The relationship can only create one context, but multiple items can be related. Please type in the number you want. The first one will be 0.'),
110
    '#description' => t('The relationship can only create one context, but multiple items can be related. Please type in the number you want. The first one will be 0. Use negative delta to get items from the end. The last item will be -1'),
102 111
    '#default_value' => empty($conf['delta']) ? 0 : $conf['delta'],
103 112
  );
104 113

  

Formats disponibles : Unified diff