twin-elements / sortable-bundle
Sortable bundle for CMS
Installs: 57
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/twin-elements/sortable-bundle
Requires
- php: ^7.4 || ^8.0
 - symfony/framework-bundle: ^4.4 || ^5.4
 - symfony/twig-bundle: ^5.4
 - twin-elements/admin-translator: ^1.0
 - twin-elements/response-parameter-builder: ^1.0
 
README
##Installation
composer require twin-elements/sortable-bundle
in /config/packages/routes.yaml add
sortable_admin:
    resource: "@TwinElementsSortableBundle/Controller/"
    prefix: /admin
    type: annotation
    requirements:
        _locale: '%app_locales%'
    defaults:
        _locale: '%locale%'
        _admin_locale: '%admin_locale%'
    options: { i18n: false }
in assets/admin/entry.js add
if(typeof IS_SORTABLE_ENABLED !== "undefined" && IS_SORTABLE_ENABLED ){
    import(/*webpackChunkName: "sortable-module"*/'../../public/bundles/twinelementssortable/js/sortable');
}
How it use?
1.In template with list marked as 'sortable'
add {% use '@TwinElementsSortable/blocks.html.twig' %}
and
{% block head_js %}
    {{ block('sortable') }}
{% endblock %}
- In controller
 
    $responseParameters = new ResponseParameterBuilder();
    $responseParameters
        ->addParameter('key',$value);
    SortableResponseParametersPreparer::prepare($responseParameters, Entity::class);