Révision b858700c
Ajouté par Assos Assos il y a environ 10 ans
drupal7/sites/all/modules/commerce/modules/price/commerce_price.module | ||
---|---|---|
116 | 116 |
// Determine the list of instances to iterate on. |
117 | 117 |
list(, , $bundle) = entity_extract_ids($entity_type, $entity); |
118 | 118 |
$instances = field_info_instances($entity_type, $bundle); |
119 |
$fields = field_info_fields(); |
|
120 | 119 |
|
121 | 120 |
// Iterate through the instances and collect results. |
122 | 121 |
foreach ($instances as $instance) { |
123 | 122 |
$field_name = $instance['field_name']; |
123 |
$field = field_info_field($field_name); |
|
124 | 124 |
|
125 | 125 |
// If the instance is a price field with data... |
126 |
if ($fields[$field_name]['type'] == 'commerce_price' && isset($entity->{$field_name})) {
|
|
126 |
if ($field['type'] == 'commerce_price' && isset($entity->{$field_name})) { |
|
127 | 127 |
$commerce_price_fields[] = $field_name; |
128 | 128 |
} |
129 | 129 |
} |
... | ... | |
216 | 216 |
} |
217 | 217 |
|
218 | 218 |
/** |
219 |
* Implements hook_field_update(). |
|
219 |
* Implements hook_field_attach_update().
|
|
220 | 220 |
* |
221 | 221 |
* This hook is used to unserialize the price field's data array after it has |
222 | 222 |
* been updated, because the data array is serialized before it is saved and |
... | ... | |
1118 | 1118 |
$value['amount'] = trim($value['amount']); |
1119 | 1119 |
$currency = commerce_currency_load($value['currency_code']); |
1120 | 1120 |
|
1121 |
// Required elements don't work on these input forms, so instead catch a NULL
|
|
1122 |
// value here and require a numeric amount. |
|
1123 |
if (empty($value['amount'])) {
|
|
1121 |
// Required elements don't work on these input forms, so instead catch |
|
1122 |
// an empty value here and require a numeric amount.
|
|
1123 |
if ($value['amount'] == '') {
|
|
1124 | 1124 |
form_error($element, t('A numeric amount is required for setting and comparing against price field data.')); |
1125 | 1125 |
} |
1126 | 1126 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules