Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Supporting organizations:
Project information
- Module categories: Site Structure
- 127 sites report using this module
- Created by Alex Zhulin on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
8.x-1.6
released 20 March 2023
Works with Drupal: ^8 || ^9 || ^10
✓ Recommended by the project’s maintainer.
Install:
Development version: 8.x-1.x-dev updated 20 Mar 2023 at 12:31 UTC