contao-graveyard/stylepicker 问题修复 & 功能扩展

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

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

contao-graveyard/stylepicker

最新稳定版本:3.0.0-RC1

Composer 安装命令:

composer require contao-graveyard/stylepicker

包简介

CSS Class selection wizard for contao

关键字:

README 文档

README

Caution

USE AT YOUR OWN RISK / Do not use in production

This plugin has been revived as an example for a conference talk at the contao conference in 2025. Whilst most, if not all the functionality is given, this extension should most likely not be used in production at all.

Contao StylePicker (formerly known as stylepicker4ward)

github version amount of downloads minimum php version

Description

This bundle adds the possibility to easily select a css-class from a predefined list.

Installation

Via composer

composer require contao-graveyard/stylepicker

Events

GetStylePickerEvent

Formerly known as the stylepicker4ward_getFilter Hook, the new implementation happens as a Symfony event that you can listen to. Please mind that the examples below need either autowiring to be on or need your own service tagging.

Old implementation

/*
 * HOOK to get table,PID(s),section and condition
 * in-parameter: str $table, int $id
 * out-parameter as array or FALSE if the callback does not match:
 * 		array($tbl,$pids,$sec,$cond)
 * 		str $tbl: table name, mostly the same as from the in-parameter
 * 		array $layout: ID of Pagelayout
 * 		str $sec: a section (column) identifier
 * 		str $cond: some addition condition
 */
if (isset($GLOBALS['TL_HOOKS']['stylepicker4ward_getFilter']) && is_array($GLOBALS['TL_HOOKS']['stylepicker4ward_getFilter'])) {
    foreach ($GLOBALS['TL_HOOKS']['stylepicker4ward_getFilter'] as $callback) {
        System::importStatic($callback[0]);
        $result = $this->{$callback[0]}->{$callback[1]}($table, $id);
        if (is_array($result)) {
            [$table, $layout, $section, $condition] = $result;
            break;
        }
    }
}

Defining in a class

<?php

namespace App\EventListener

use ContaoGraveyard\StylePickerBundle\Event\GetStylePickerFilterEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener]
class StylePickerEventListener
{
    public function __invoke(GetStylePickerFilterEvent $event): void
    {
        if ($event->getTable() !== 'my_table') {
            return;
        }

        $event->setLayout(213);
        $event->setCondition('foobar');
        $event->setSection('your_section');
    }
}

Directly on the method

<?php

namespace App\EventListener

use ContaoGraveyard\StylePickerBundle\Event\GetStylePickerFilterEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

class MyMultiListener
{
    #[AsEventListener]
    public function onGetStylePickerFilterEvent(GetStylePickerFilterEvent $event): void
    {
        // ...
    }
}

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2025-09-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固