manuxi/sulu-bulk-actions-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

manuxi/sulu-bulk-actions-bundle

最新稳定版本:0.1.0

Composer 安装命令:

composer require manuxi/sulu-bulk-actions-bundle

包简介

Bulk Actions for Sulu bundles.

README 文档

README

License: MIT GitHub Tag Supports Sulu 2.6 or later

I made this bundle to have the possibility to manage bulk actions in lists of my projects.

Please feel comfortable submitting feature requests. This bundle is still in development. Use at own risk 🤞🏻

👩🏻‍🏭 Installation

Some tasks are awaiting you!

Install the package with:

composer require manuxi/sulu-bulk-actions-bundle

Rebuild admin sources:

    cd assets/admin
    npm install
    npm run build
  1. Then add the config for resourcekey and actions to Admin in project/bundle
    public function getConfigKey(): ?string
    {
        return 'sulu_mybundle';
    }

    public function getConfig(): ?array
    {
        return [
            'resourceKey' => 'mybundle',  //with this, the route is build: /admin/api/{resourceKey}/bulk-{action}
            'bulkActions' => [
                'publish' => ['icon' => 'su-eye'],
                'unpublish' => ['icon' => 'su-eye-slash'],
            ],
        ];
    }
  1. The action-buttons must be added to the Admin-Class in project/bundle
    $listToolbarActions[] = new ToolbarAction('app.bulk.actions_dropdown', [
        'label' => 'sulu_bulk_actions.actions',
        'icon' => 'su-pen',
        'actions' => [
            'app.bulk.publish',
            'app.bulk.unpublish',
        ],
    ]);
  1. Add a handler in project/bundle
    class MybundleBulkActionHandler
    {
        public function __construct(
            private readonly MybundleModel $model,
        ) {
        }
    
        public function supports(string $resourceKey, string $action): bool
        {
            return 'testimonials' === $resourceKey
                && in_array($action, ['publish', 'unpublish']);
        }
    
        public function handle(string $action, array $ids, Request $request): array
        {
            return match ($action) {
                'publish' => $this->tmodel->publishBulk($ids, $request),
                'unpublish' => $this->model->unpublishBulk($ids, $request),
                default => [],
            };
        }
    }

Thats mainly all.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-23