- PHP 59.3%
- Twig 29.2%
- JavaScript 11.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| .github | ||
| .idea | ||
| assets | ||
| config/templates/blocks | ||
| doc/css-api/blocks | ||
| examples/pages | ||
| src | ||
| templates | ||
| templates-override/components | ||
| tests | ||
| translations | ||
| .gitattributes | ||
| .gitignore | ||
| .php-cs-fixer.dist.php | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| composer.json | ||
| LICENSE | ||
| phpstan.neon.dist | ||
| phpunit.xml.dist | ||
| Projekt.md | ||
| README.md | ||
WSC Sulu Bundle – Tailwind Theme Extra Blocks
Additional content blocks for
itech-world/sulu-tailwind-theme-bundle
(Sulu CMS 3.x). This is not a fork: the original bundle stays untouched, this
bundle depends on it and registers extra block types next to the original ones
via sulu_admin.templates.block.directories.
Blocks:
| Block | What it does |
|---|---|
columns |
2, 3 or 4 columns side by side, each column takes any other block |
locations |
One map with several pins (the theme's location block has one) |
locations_pages |
One map whose pins come from pages (smart content): popup links to the page, optional filter by category |
Requirements
- Sulu CMS >= 3.0
- PHP >= 8.2
- Tailwind CSS >= 4.0, Webpack Encore, Doctrine ORM >= 3.0
itech-world/sulu-tailwind-theme-bundle(branchfeat/3.0.0until 3.0.0 is released)
Installation
-
Add the VCS repository of the theme bundle to your project
composer.json(needed only until 3.0.0 is released) and require this bundle:composer require wsc/sulubundle-tailwindthemeextrablocks -
Register the bundle in
config/bundles.php, after the theme bundle:Wsc\SuluBundleTailwindThemeExtraBlocks\WscSuluBundleTailwindThemeExtraBlocksBundle::class => ['all' => true], -
Let Tailwind scan the templates of this bundle, in your main CSS file (next to the
@sourceline of the theme bundle):@source "../../vendor/wsc/sulubundle-tailwindthemeextrablocks/templates"; -
Only for the
locationsblock: add the JavaScript package of this bundle (the Stimulus controller of the map) to yourpackage.json, next to the theme package, and enable it inassets/controllers.json:"@wsc/sulubundle-tailwindthemeextrablocks": "file:vendor/wsc/sulubundle-tailwindthemeextrablocks/assets""@wsc/sulubundle-tailwindthemeextrablocks": { "locations_map": { "enabled": true, "fetch": "lazy" } }It builds on the map controller and
leafletof the theme bundle, which are already installed. -
Build the assets and clear the cache:
npm run build bin/console cache:clear -
Offer the blocks on your pages (see "Using the blocks in the Default page").
Columns block
A layout container with 2, 3 or 4 columns (stacked on mobile). Every column takes any global block of the theme bundle, except the columns block itself: a column inside a column is deliberately not offered.
Limits worth knowing:
- The block types a column offers are listed in
config/templates/blocks/columns.xml. When the theme bundle gets a new block, it has to be added there. - The block shares the theme bundle's settings fragments through a relative
xi:includeintovendor/itech-world/. With a composer path repository use"options": {"symlink": false}, otherwise the path does not resolve.
Locations block
One map with several pins. Each pin is a Sulu location field; the map shows all of them and fits them into view. Layout: map only, or the map with a list of the pins next to it. Map height: small, medium, large.
- Settings come from the theme. Tile provider, custom tile URL, scroll-zoom mode, marker image/icon and the consent handling are the ones of Components > Maps in the theme settings; there is nothing to configure twice.
- The Stimulus controller
wsc-locations-mapextends the map controller of the theme bundle. It depends on methods that are not a public API of the theme;LocationsMapControllerContractTestfails when they disappear. - The four tile presets are a copy of the theme's table;
LocationsTemplateContractTestfails when the theme changes them. - Can be placed inside a column of the columns block.
Using the blocks in the Default page
The page template "Default page" of the theme bundle lists its blocks in the theme bundle, which this bundle cannot extend. Copy the ready-made template into your project once:
mkdir -p config/templates/pages
cp vendor/wsc/sulubundle-tailwindthemeextrablocks/examples/pages/iw_theme_default.xml config/templates/pages/
bin/adminconsole cache:clear
A template of the project wins over the one of the theme bundle (same key
iw_theme_default), so "Default page" now offers Columns next to all other
blocks, plus Locations (multiple pins). For your own page templates add
<type ref="columns"/>, <type ref="locations"/> and <type ref="locations_pages"/> to their block list.
Block locations_pages
Every selected page that has a Sulu location field named location gets a pin. The popup links to the page, the categories of the page (Excerpt tab) become buttons in the map that show only the pins of one category. The filter is built with JavaScript and ships with an inline look, the classes iw-locations-map__filter and iw-locations-map__filter-button are hooks for your own CSS.
To drive the map from a filter outside the block (e.g. category links above a member list), set URL parameter for the category (Settings), e.g. branche. The map then shows only the pins whose page has the category id from ?branche=<id>; an unknown value shows all pins. The filter bar in the map is switched off in that case, so there is one filter only.
Why not automatically? Sulu builds the admin form of a page from the template and its JSON schema. When a bundle registers a second file with the key of an existing template, the two disagree and the form does not load. When the theme bundle gets a new block or changes its default page, update your copy.
Structure
| Directory | Content |
|---|---|
src/ |
Bundle class |
config/templates/blocks/ |
Block definitions (Sulu XML), registered with the admin |
templates/ |
Twig templates of the blocks |
examples/ |
Ready-to-copy page template with the columns block |
templates-override/ |
Replaces the block dispatcher of the theme bundle so it also renders the blocks of this bundle |
translations/ |
Admin translations (FR, EN, DE) |
assets/ |
Frontend assets: Stimulus controller of the locations map |
doc/css-api/blocks/ |
CSS API documentation per block |
tests/ |
PHPUnit tests |
License
MIT, see LICENSE.