双元素/可排序捆绑包

用于CMS的可排序捆绑包

安装: 49

依赖: 1

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

公开问题: 0

类型:symfony-bundle

v1.0.3 2022-07-29 12:14 UTC

This package is auto-updated.

Last update: 2024-09-16 01:27:36 UTC


README

##安装 composer require twin-elements/sortable-bundle

/config/packages/routes.yaml 中添加

sortable_admin:
    resource: "@TwinElementsSortableBundle/Controller/"
    prefix: /admin
    type: annotation
    requirements:
        _locale: '%app_locales%'
    defaults:
        _locale: '%locale%'
        _admin_locale: '%admin_locale%'
    options: { i18n: false }

assets/admin/entry.js 中添加

if(typeof IS_SORTABLE_ENABLED !== "undefined" && IS_SORTABLE_ENABLED ){
    import(/*webpackChunkName: "sortable-module"*/'../../public/bundles/twinelementssortable/js/sortable');
}

如何使用?

1. 在标记为 'sortable' 的列表模板中

添加 {% use '@TwinElementsSortable/blocks.html.twig' %}

并且

{% block head_js %}
    {{ block('sortable') }}
{% endblock %}
  1. 在控制器中
    $responseParameters = new ResponseParameterBuilder();
    $responseParameters
        ->addParameter('key',$value);

    SortableResponseParametersPreparer::prepare($responseParameters, Entity::class);