function _content_sort_items in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 6.3 content.module \_content_sort_items()
- 6.2 content.module \_content_sort_items()
Helper function to sort items in a field according to user drag-n-drop reordering.
2 calls to _content_sort_items()
- content_add_more_js in includes/
content.node_form.inc - Menu callback for AHAH addition of new empty widgets.
- content_field in ./
content.module - Implementation of hook_field(). Handles common field housekeeping.
File
- ./
content.module, line 811 - Allows administrators to associate custom fields to content types.
Code
function _content_sort_items($field, $items) {
if ($field['multiple'] >= 1 && isset($items[0]['_weight'])) {
usort($items, '_content_sort_items_helper');
foreach ($items as $delta => $item) {
unset($items[$delta]['_weight']);
}
}
return $items;
}