oneup / contao-backend-sortable-list-views
Makes backend list views sortable even without a parent table.
Package info
github.com/1up-lab/contao-backend-sortable-list-views
Type:contao-bundle
pkg:composer/oneup/contao-backend-sortable-list-views
Requires
- php: ^8.1
- contao/core-bundle: ^5.3 || ^6.0
- contao/manager-plugin: ^2.3.1
- doctrine/dbal: ^3.7 || ^4.4
- symfony/config: ^6.4 || ^7.4 || ^8.0
- symfony/dependency-injection: ^6.4 || ^7.4 || ^8.0
- symfony/http-foundation: ^6.4 || ^7.4 || ^8.0
- symfony/http-kernel: ^6.4 || ^7.4 || ^8.0
- symfony/routing: ^6.4 || ^7.4 || ^8.0
- symfony/security-core: ^6.4 || ^7.4 || ^8.0
- twig/twig: ^3.0
Requires (Dev)
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Adds the missing sorting mode to Contao: custom sort without the need for a parent table.
Installation
Require bundle
composer require oneup/contao-backend-sortable-list-views
Add routes
# config/routes.yaml OneupContaoBackendSortableListViewsBundle: resource: "@OneupContaoBackendSortableListViewsBundle/config/routes.yaml"
Configuration
# contao/dca/tl_my_custom_table.php // Add sorting flag $GLOBALS['TL_DCA']['tl_my_custom_table']['list']['sorting']['sortableListView'] = true; // Add database field $GLOBALS['TL_DCA']['tl_my_custom_table']['fields']['sorting']['sql'] = 'int(10) unsigned NOT NULL default 0';
Run a Contao migration / database update and enjoy happy drag&drop sorting!
Permissions
A sort request is only accepted if the user may access the back end module and the data container voters grant
ContaoCorePermissions::DC_PREFIX . $table for an UpdateAction on the moved record (new sorting value). Restrict
sorting with your own data container voter.
Development
Backend
Install dependencies
composer install
Run the code style fixer
php composer cs-fixer
Run the static analyzer
php composer phpstan
Run the unit tests
php composer phpunit
Frontend
Install dependencies
npm install
Build frontend assets
npm run build