- #371306 fix duplicate HTML when using the JS-'add more' button.
- #370004 by dopry - Fix JS-'add more' button breaking fielfield's AHAH upload.
- #374213 by rpanna - Fieldgroup: All field instances removed their groups when one instance is deleted from a content type.
+- #356158 by markus_petrux - Fix more (hopefully all ?) cases of bogus d-n-d reordering of 'pseudo-fields'.
CCK 6.x-2.1
===========
// Special case for 'view' op, we want to adjust weights of non-cck fields
// even if there are no actual fields for this type.
if ($op == 'view') {
- foreach ($type['extra'] as $key => $value) {
- // Some core 'fields' use a different key in node forms and in 'view'
- // render arrays.
- if (isset($value['view']) && isset($node->content[$value['view']])) {
- $node->content[$value['view']]['#weight'] = $value['weight'];
- }
- elseif (isset($node->content[$key])) {
- $node->content[$key]['#weight'] = $value['weight'];
- }
- }
+ $node->content['#pre_render'][] = 'content_alter_extra_weights';
+ $node->content['#content_extra_fields'] = $type['extra'];
}
}
}
// Merge field widgets.
$form = array_merge($form, content_form($form, $form_state));
}
- // Adjust weights for non-CCK fields.
- foreach ($type['extra'] as $key => $value) {
- if (isset($form[$key])) {
- $form[$key]['#weight'] = $value['weight'];
+ $form['#pre_render'][] = 'content_alter_extra_weights';
+ $form['#content_extra_fields'] = $type['extra'];
+ }
+}
+
+/**
+ * Pre-render callback to adjust weights of non-CCK fields.
+ */
+function content_alter_extra_weights($elements) {
+ if (isset($elements['#content_extra_fields'])) {
+ foreach ($elements['#content_extra_fields'] as $key => $value) {
+ // Some core 'fields' use a different key in node forms and in 'view'
+ // render arrays. Check we're not on a form first.
+ if (!isset($elements['#build_id']) && isset($value['view']) && isset($elements[$value['view']])) {
+ $elements[$value['view']]['#weight'] = $value['weight'];
+ }
+ elseif (isset($elements[$key])) {
+ $elements[$key]['#weight'] = $value['weight'];
}
}
}
+ return $elements;
}
/**