Download the PHP package n-ramos/celebrimbor-bundle without Composer
On this page you can find all versions of the php package n-ramos/celebrimbor-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download n-ramos/celebrimbor-bundle
More information about n-ramos/celebrimbor-bundle
Files in n-ramos/celebrimbor-bundle
Package celebrimbor-bundle
Short Description Symfony bundle connecting a Doctrine entity to the Celebrimbor visual page builder, with interface contracts and a Doctrine trait for the model, a Form type wired to Symfony UX/Stimulus, and a Twig per-block preview renderer.
License MIT
Informations about the package celebrimbor-bundle
Celebrimbor Bundle
Symfony bundle that connects a Doctrine entity to the Celebrimbor headless visual page builder. It ships no blocks — you bring your own JS block registry. The bundle provides the PHP plumbing:
- a contract (
HasPageBuilderContent) + Doctrine trait for your model, - a Form type (
PageBuilderType) wired to the Symfony UX / Stimulus controller from@n-ramos/celebrimbor-symfony, - a per-block Twig preview renderer (
CelebrimborRenderer) and anAbstractPreviewControlleryou extend with a single route.
The JavaScript half (the <my-page-builder> web component, the Stimulus
controller, your block registry) lives in the npm package
@n-ramos/celebrimbor-symfony, installed via AssetMapper/importmap.
Install
Register your blocks once in your AssetMapper entry (e.g. assets/app.js):
1. The model
Implement the contract and use the trait. The trait maps a nullable JSON
document column and stores the editor payload raw.
Override pageBuilderFormat() to return PageBuilderFormat::Document if you
store the full PageDocument instead of the default portable block list.
2. The form
The field renders <my-page-builder> with the celebrimbor--page-builder
Stimulus controller and transforms the document array ⇄ JSON automatically. The
bundle auto-registers its form theme; if you disabled auto theming, add
@Celebrimbor/form/celebrimbor_form_theme.html.twig to twig.form_themes.
3. The preview
A preview is just a controller calling the bundle. Two strategies:
For strategy A, create one template per block type under your configured
prefix (default blocks/), e.g. templates/blocks/hero.html.twig:
Each block template receives the block fields spread at top level, plus
fields, settings, children (pre-rendered) and block.
For strategy B, override
templates/bundles/CelebrimborBundle/preview/js_preview.html.twig to add an
AssetMapper entry that calls mountCelebrimborPreview({ registry }).
Configuration
License
MIT.
All versions of celebrimbor-bundle with dependencies
symfony/config Version ^6.4|^7.0|^8.0
symfony/dependency-injection Version ^6.4|^7.0|^8.0
symfony/http-kernel Version ^6.4|^7.0|^8.0