This module provides a form element and field widget that allows users to select items and maintain their chosen order. It works with existing list field types in Drupal.
This module provides an ordered list form element and field widget. In contrast to other list elements/widgets, the ordered list preserves the order of the selected items.
Field widget is available for all built-in list field types.
Form element example:
$form['list'] = [
'#type' => 'ordered_list',
'#title' => t('List'),
'#title_display' => 'invisible',
'#description' => t('Description.'),
'#options' => [
'item1' => t('Item 1'),
'item2' => t('Item 2'),
'item3' => t('Item 3'),
'item4' => t('Item 4'),
],
'#default_value' => ['item4', 'item2'],
'#required' => TRUE,
'#disabled' => FALSE,
'#labels' => [
'items_available' => t('Available'),
'items_selected' => t('Selected'),
'control_select' => t('Select'),
'control_deselect' => t('Deselect'),
'control_moveup' => t('Move Up'),
'control_movedown' => t('Move Down'),
],
];
Installation
- Install as usual, see https://drupal.org/node/2781613 for further information.
Credits
Current maintainers:
- Alex Zhulin (Alex Zhulin) - https://drupal.org/user/2659881
Ask your assistant about Ordered List
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 8.x-1.6 | Stable | 8–10 | Mar 20, 2023 |