Révision 136a805a
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc | ||
---|---|---|
137 | 137 |
$field_settings['settings'] = $conf['formatter_settings']; |
138 | 138 |
} |
139 | 139 |
|
140 |
$clone = clone $entity; |
|
140 | 141 |
$all_values = field_get_items($entity_type, $entity, $field_name, $language); |
141 |
if (!is_array($all_values)) { |
|
142 |
// Do not render if the field is empty. |
|
143 |
return; |
|
144 |
} |
|
145 | 142 |
|
146 |
// Reverse values. |
|
147 |
if (isset($conf['delta_reversed']) && $conf['delta_reversed']) { |
|
148 |
$all_values = array_reverse($all_values, TRUE); |
|
149 |
} |
|
143 |
if (is_array($all_values)) { |
|
144 |
// Reverse values. |
|
145 |
if (isset($conf['delta_reversed']) && $conf['delta_reversed']) { |
|
146 |
$all_values = array_reverse($all_values, TRUE); |
|
147 |
} |
|
148 |
|
|
149 |
if (isset($conf['delta_limit'])) { |
|
150 |
$offset = intval($conf['delta_offset']); |
|
151 |
$limit = !empty($conf['delta_limit']) ? $conf['delta_limit'] : NULL; |
|
152 |
$all_values = array_slice($all_values, $offset, $limit, TRUE); |
|
153 |
} |
|
150 | 154 |
|
151 |
if (isset($conf['delta_limit'])) { |
|
152 |
$offset = intval($conf['delta_offset']); |
|
153 |
$limit = !empty($conf['delta_limit']) ? $conf['delta_limit'] : NULL; |
|
154 |
$all_values = array_slice($all_values, $offset, $limit, TRUE); |
|
155 |
$clone->{$field_name}[$language] = $all_values; |
|
155 | 156 |
} |
156 | 157 |
|
157 |
$clone = clone $entity; |
|
158 |
$clone->{$field_name}[$language] = $all_values; |
|
159 | 158 |
$field_output = field_view_field($entity_type, $clone, $field_name, $field_settings, $language); |
160 | 159 |
|
161 | 160 |
if (!empty($field_output) && !empty($conf['override_title'])) { |
... | ... | |
270 | 269 |
$identifier = $context->identifier; |
271 | 270 |
} |
272 | 271 |
else { |
273 |
$type = 'ctools_entity_field_content_type_admin_title'; |
|
274 |
$message = t('Context is missing for field: @name', array('@name' => $subtype)); |
|
275 |
$variables = array($subtype, $conf, $context); |
|
276 |
watchdog($type, $message, $variables, $severity = WATCHDOG_NOTICE); |
|
272 |
watchdog('ctools_entity_field_content_type_admin_title', 'Context is missing for field: @name', array('@name' => $subtype), WATCHDOG_NOTICE); |
|
277 | 273 |
$identifier = t('Unknown'); |
278 | 274 |
} |
279 | 275 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules