Download the PHP package trk/sulu-preline-blocks-bundle without Composer
On this page you can find all versions of the php package trk/sulu-preline-blocks-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download trk/sulu-preline-blocks-bundle
More information about trk/sulu-preline-blocks-bundle
Files in trk/sulu-preline-blocks-bundle
Package sulu-preline-blocks-bundle
Short Description Preline UI component blocks and responsive templates for Sulu CMS
License MIT
Homepage https://github.com/trk/SuluPrelineBlocksBundle
Informations about the package sulu-preline-blocks-bundle
Sulu Preline Blocks Bundle
An enterprise-grade, accessible, and fully customizable Preline UI 5 & Tailwind CSS 4 component library bundle for Sulu CMS 3.x / 2.5+, powered by Symfony UX Twig Components and trk/sulu-block-suite-bundle.
Table of Contents
- Overview & Philosophy
- Key Features
- Core Blocks
- Requirements
- Installation
- 1. Composer Package
- 2. Register the Bundle
- 3. Tailwind CSS 4 Configuration
- 4. Preline UI JavaScript Setup
- 5. Enable Blocks in Page Templates
- Architecture & Override Mechanics
- 1. Overriding Block XML Structures
- 2. Overriding Prop Schemas & Presets
- 3. Overriding Twig Components & HTML
- 4. Creating Custom Project Blocks
- Sulu Live Preview Integration
- Testing & Quality Assurance
- License
Overview & Philosophy
Modern CMS websites often suffer from tight coupling: hardcoded HTML in page templates, scattered CSS utilities, and rigid admin block schemas.
SuluPrelineBlocksBundle solves this by introducing a decoupled, 3-tier architecture:
Zero Hardcoding Guarantee
- Never hardcode markup: Block templates delegate directly to Twig Components (
<twig:Card ... />). - Never hardcode styles: Visual styling is driven by structured YAML prop schemas, customizable via the visual admin modal.
- 100% Overridable: Every XML block structure, Twig template, prop schema, and preset can be overridden in the host application without modifying vendor code.
Key Features
- 9 Preline UI 5 Blocks: Complete accessible implementations for Card, Headline, Text, Alert, Button, Divider, Image, Video, and Overlay.
- Tailwind CSS 4 CSS-First Scanning: Seamless
@sourceintegration with zero stylesheet bloat. - Symfony UX Twig Components: Type-safe, isolated PHP component classes with dedicated props resolvers and element transforms.
- Accessible & Responsive: Full WCAG compliance, keyboard focus rings, dark mode support (
dark:modifiers), and responsive variants. - Sulu Live Preview Auto-Rebind: Automatically invokes Preline's
HSStaticMethods.autoInit()during Sulu preview postMessage events. - Interactive Props Modal: Fully integrated with
trk/sulu-block-suite-bundlefor real-time visual styling in the Sulu Admin panel.
Core Blocks
| Block | Description | Interactive Features |
|---|---|---|
| Card | Feature cards, blog cards, profile cards, product cards | Media banner, badges, hover zoom, multiple buttons, icon cards |
| Headline | Semantic headings (h1-h6, div, span) |
Visual style scaling, accent badges, alignments, letter spacing |
| Text | Rich text & lead paragraphs | Multi-column layouts, lead styles, line-height, text colors |
| Alert | Accessible notification callouts | Dismiss button (data-hs-remove-element), 5 semantic variants, soft/outline styles |
| Button | CTAs, links, and action buttons | 8 visual variants, icons, rounded-full, pill, sizes (xs-xl) |
| Divider | Section separators | Solid, dashed, dotted, gradients, embedded text/icons |
| Image | Single and gallery images | Aspect ratios, lazy loading, lightbox triggers, hover zoom |
| Video | Responsive video players | YouTube/Vimeo embeds, HTML5 video, autoplay, controls, modal trigger |
| Overlay | Full-featured modals and drawers | Preline data-hs-overlay, backdrop blur, size controls, customizable actions |
Requirements
- PHP:
>= 8.2(Fully tested on PHP 8.2, 8.3, 8.4, and 8.5) - Sulu CMS:
^2.5 || ^3.0 - Symfony:
^6.4 || ^7.0 - Preline UI:
>= 5.0 - Tailwind CSS:
>= 4.0 trk/sulu-block-suite-bundle:^1.0
Installation
1. Composer Package
2. Register the Bundle
In config/bundles.php:
3. Tailwind CSS 4 Configuration
In your website's main stylesheet (e.g. assets/website/src/app.css):
4. Preline UI JavaScript Setup
In your frontend entry point (e.g. assets/website/src/app.js):
5. Enable Blocks in Page Templates
-
Reference the bundle's blocks in your page XML or include file (e.g.
config/templates/includes/blocks.xml): - Render the blocks in your page template (e.g.
templates/pages/default.html.twig):
The bundle's block templates automatically resolve styling props, merge presets, and render the underlying accessible Twig Components (<twig:Card ... />, <twig:Button ... />, etc.).
Architecture & Override Mechanics
1. Overriding Block XML Structures
Sulu automatically checks the host application's config/templates/blocks/ directory before consulting bundle directories. To customize any block's admin fields, place an XML file with the same name in your project:
2. Overriding Prop Schemas & Defining Presets
SuluPrelineBlocksBundle provides the foundational prop schemas in config/blocks/props/ and deliberately contains no presets. Presets are 100% project-driven:
- Schemas:
config/blocks/props/card.yamlin your project overrides the bundle's defaultcard.yaml. - Presets: Create
config/blocks/presets/card.yamlin your project to define brand-specific visual style presets.
3. Overriding Twig Components & HTML
To override the HTML markup of any component:
- Symfony UX Twig Override: Place a template at
templates/bundles/SuluPrelineBlocksBundle/components/Card.html.twig. - Block Template Override: Place a template at
templates/blocks/card.html.twig.
4. Creating Custom Project Blocks
Adding a brand-specific block (e.g. hero) is straightforward:
- Create
config/templates/blocks/hero.xml. - Add
<type ref="hero"/>to yourconfig/templates/includes/blocks.xml. - Create
templates/blocks/hero.html.twigor<twig:Hero ... />. - (Optional) Create
config/blocks/props/hero.yamlandconfig/blocks/presets/hero.yamlfor visual styling in the Sulu modal!
Sulu Live Preview Integration
Preline UI relies on DOM attributes to initialize collapses, modals, dropdowns, and accordions. Because Sulu CMS Live Preview updates the page dynamically via iframe messages, window.HSStaticMethods.autoInit() is required to re-bind interactive behaviors.
The bundle's included templates and components are designed to re-initialize seamlessly without memory leaks or duplicate event listeners.
Testing & Quality Assurance
SuluPrelineBlocksBundle is tested against a rigorous quality matrix:
- PHP 8.5 Strict Typing: Every PHP file enforces
declare(strict_types=1);. - PHPStan Level Max: 100% clean static analysis with zero errors.
- PHPUnit 12 Tested: 67 tests, 481 assertions passing with 0 notices.
- Cross-Version Matrix: Tested across PHP 8.2, 8.3, 8.4, and 8.5 on Symfony 6.4 and 7.4.
CI workflows automatically execute the test suite across PHP 8.2, 8.3, 8.4, and 8.5 on every commit and pull request.
License
This bundle is open-source software licensed under the MIT License.
All versions of sulu-preline-blocks-bundle with dependencies
sulu/sulu Version ^3.0
symfony/config Version ^7.0
symfony/dependency-injection Version ^7.0
symfony/form Version ^7.0
symfony/http-kernel Version ^7.0
symfony/ux-twig-component Version ^2.13 || ^3.0
trk/sulu-block-suite-bundle Version ^0.2
twig/twig Version ^3.0