Bindings
Sample documentation (demo only)
This is an incomplete, outdated docs snapshot shipped with the playground — screenshots were removed on purpose.
For the full, current manuals go to voodflow.com/docs.
Voodflow\Voodbuilder\Support\Editor\Bindings\AbstractModelIntegrationBindingSource
- File:
Support/Editor/Bindings/AbstractModelIntegrationBindingSource.php - Kind:
class - Implements:
EditorBindingSource - Responsibility: Abstract Model Integration Binding Source.
Methods
public function __construct( protected readonly ModelIntegration $integration, )- Constructor.
public function package(): string- Package slug used to group this source in the editor UI.
public function packageLabel(): string- Human-readable package group label in the editor UI.
public function label(): string- Human-readable label shown in the admin/editor UI.
protected function fieldsForEssentialKeys(): array- Fields For Essential Keys.
protected function fieldsForRelationKeys(array $definition): array- Fields For Relation Keys.
protected function relationEagerLoads(): array- Relation Eager Loads.
protected function resolveFieldValue(Model $record, string $fieldId, ?BindingContext $context = null): ?string- Resolve Field Value.
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingAttributes
- File:
Support/Editor/Bindings/BindingAttributes.php - Kind:
class - Responsibility: HTML attribute names for Editor field bindings.
No public/protected methods.
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingContext
- File:
Support/Editor/Bindings/BindingContext.php - Kind:
class - Responsibility: Binding Context.
Methods
public function __construct( public ?SitePage $page = null, public ?string $locale = null, public mixed $repeatItem = null, public bool $editorPreview = false, public mixed $routeItem = null, public array $routeEntities = [], public ?string $dynamicChannel = null, )- Constructor.
public static function forPage(?SitePage $page, mixed $repeatItem = null): self- For Page.
public static function forEditorPreview(SitePage $page, ?Request $request = null): self- For Editor Preview.
public function withRepeatItem(mixed $repeatItem): self- With Repeat Item.
public function withRouteEntities(array $routeEntities, ?string $channel = null): self- With Route Entities.
public function routeEntity(string $key): mixed- Route Entity.
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingField
- File:
Support/Editor/Bindings/BindingField.php - Kind:
class - Responsibility: Binding Field.
Methods
public function __construct( public string $id, public string $label, public string $type = self::TYPE_TEXT, public ?string $group = null, )- Constructor.
public function toArray(): array- Convert / serialize via
toArray.
- Convert / serialize via
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingImageAltResolver
- File:
Support/Editor/Bindings/BindingImageAltResolver.php - Kind:
class - Responsibility: Binding Image Alt Resolver.
Methods
public function __construct( private readonly BindingRegistry $registry, )- Constructor.
public function resolve(string $bindingKey, BindingContext $context): ?string- Resolve a runtime value for the given field / context.
public static function isPlaceholderAlt(string $value): bool- Boolean predicate
isPlaceholderAlt.
- Boolean predicate
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingImageResolverRegistry
- File:
Support/Editor/Bindings/BindingImageResolverRegistry.php - Kind:
class - Responsibility: Level 4 — plugin-specific image URL hooks for exotic storage (CDN, signed URLs, etc.).
Methods
public function register(string $modelClass, string $fieldId, callable $resolver): void- Performs
registerside effects.
- Performs
public function resolve(Model $record, string $fieldId, BindingContext $context): ?string- Resolve a runtime value for the given field / context.
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingKey
- File:
Support/Editor/Bindings/BindingKey.php - Kind:
class - Responsibility: Binding Key.
Methods
public function __construct( public string $sourceId, public string $fieldId, )- Constructor.
public function toAttribute(): string- Convert / serialize via
toAttribute.
- Convert / serialize via
public static function tryParse(string $raw, BindingRegistry $registry): ?self- Try Parse.
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingMediaUrlResolver
- File:
Support/Editor/Bindings/BindingMediaUrlResolver.php - Kind:
class - Responsibility: Resolve editor-safe image URLs across plugins (public disk paths, Spatie Media Library, etc.).
Methods
public static function resolve( Model $record, string $fieldId, ?string $resolvedValue = null, bool | BindingContext $previewContext = false, ): ?string- Resolve a runtime value for the given field / context.
public static function editorMediaPreviewPath(int $mediaId): string- Editor Media Preview Path.
public static function normalizeForEditor(string $value): string- Normalize For Editor.
public static function resolveFromMediaLibrary( Model $record, string $fieldId, bool $forEditorPreview = false, ): ?string- Resolve From Media Library.
protected static function mediaToEditorUrl(mixed $media, bool $forEditorPreview = false): ?string- Media To Editor Url.
protected static function bindingContext(bool | BindingContext $previewContext): BindingContext- Binding Context.
protected static function candidateCollections(string $fieldId): array- Boolean predicate
candidateCollections.
- Boolean predicate
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingPlaceholders
- File:
Support/Editor/Bindings/BindingPlaceholders.php - Kind:
class - Responsibility: Binding Placeholders.
Methods
public static function imageDataUri(): string- Image Data Uri.
public static function text(string $sourceLabel, string $fieldLabel): string- Text.
public static function isPlaceholderText(string $value): bool- Boolean predicate
isPlaceholderText.
- Boolean predicate
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingRegistry
- File:
Support/Editor/Bindings/BindingRegistry.php - Kind:
class - Responsibility: Binding Registry.
Methods
public function register(EditorBindingSource $source): self- Register routes, blocks, channels, and bindings for this module.
public function forget(string $sourceId): self- Forget.
public function has(string $sourceId): bool- Boolean predicate
has.
- Boolean predicate
public function source(string $sourceId): ?EditorBindingSource- Source.
public function hasField(string $sourceId, string $fieldId): bool- Boolean predicate
hasField.
- Boolean predicate
public function field(string $sourceId, string $fieldId): ?BindingField- Field.
public function resolve(string $bindingKey, BindingContext $context): ?string- Resolve a runtime value for the given field / context.
public function sourceIdsByLengthDesc(): array- Source Ids By Length Desc.
public function catalog(): array- id: string, label: string,
public function catalogGroupedByPackage(): array- Catalog Grouped By Package.
Voodflow\Voodbuilder\Support\Editor\Bindings\BindingUrlResolver
- File:
Support/Editor/Bindings/BindingUrlResolver.php - Kind:
class - Responsibility: Resolve binding URLs from model accessors, getUrl(), or stored values.
Methods
public static function resolve(Model $record, string $fieldId): ?string- Resolve a runtime value for the given field / context.
public static function normalize(string $url): string- Normalize markup or attributes into the canonical storage form.
protected static function looksLikeAbsoluteOrRootUrl(string $value): bool- Looks Like Absolute Or Root Url.
Voodflow\Voodbuilder\Support\Editor\Bindings\BuiltinBindingSources
- File:
Support/Editor/Bindings/BuiltinBindingSources.php - Kind:
class - Responsibility: Builtin Binding Sources.
Methods
public static function register(BindingRegistry $registry): void- Performs
registerside effects.
- Performs
Voodflow\Voodbuilder\Support\Editor\Bindings\EditorBindingNormalizer
- File:
Support/Editor/Bindings/EditorBindingNormalizer.php - Kind:
class - Responsibility: Editor Binding Normalizer.
Methods
public function __construct( private readonly BindingRegistry $registry, )- Constructor.
public function normalizeHtml(string $html): string- Normalize HTML into the canonical storage / render form.
Voodflow\Voodbuilder\Support\Editor\Bindings\EditorBindingRenderer
- File:
Support/Editor/Bindings/EditorBindingRenderer.php - Kind:
class - Responsibility: Editor Binding Renderer.
Methods
public function __construct( private readonly BindingRegistry $registry, )- Constructor.
public function render(string $html, ?SitePage $page = null, mixed $repeatItem = null): string- Render stored markup for the current context.
public function renderForEditor(string $html, ?SitePage $page = null): string- Same bindings, but for the authoring canvas.
protected function loadDocument(string $html): DOMDocument- Load Document.
protected function boundElements(DOMDocument $document): array- Bound Elements.
protected function applyBinding(DOMElement $element, BindingContext $context, bool $forEditor = false): void- Performs
applyBindingside effects.
- Performs
protected function placeholderFor(string $sourceId, BindingField $field): string[Current event: Title]— the same shape the editor's JS and the storage normalizer use, so a placeholder written by any of them is recognised by the others.
protected function shouldHideWhenEmpty(DOMElement $element): bool- Should Hide When Empty.
protected function applyImageBinding(DOMElement $element, string $url, string $bindingKey, BindingContext $context): void- Performs
applyImageBindingside effects.
- Performs
protected function resolveImageBindingElement(DOMElement $element): ?DOMElement- Image bindings usually live on
. Background image heroes may carry the bind on the section / media layer — retarget to the hero media image.
- Image bindings usually live on
protected function imageAltResolver(): BindingImageAltResolver- Image Alt Resolver.
protected function applyUrlBinding(DOMElement $element, string $url): DOMElement- Apply Url Binding.
protected function replaceButtonWithLink(DOMElement $button, string $url): DOMElement- A bound button navigates, so it becomes a real link: inline
onclickwould be stripped by the security sanitizer and never worked on the published page.
- A bound button navigates, so it becomes a real link: inline
protected function stripSpuriousDirectTextNodes(DOMElement $element): void- Card-style URL bindings only set href. Remove direct text nodes that were accidentally scraped from nested title/category copy in the editor.
protected function applyTextBinding(DOMElement $element, string $text, string $tag): void- Performs
applyTextBindingside effects.
- Performs
protected function isAnimatedCounterElement(DOMElement $element): bool- Boolean predicate
isAnimatedCounterElement.
- Boolean predicate
protected function extractBodyHtml(DOMDocument $document): ?string- Extract Body Html.
Voodflow\Voodbuilder\Support\Editor\Bindings\EditorBindingStorageNormalizer
- File:
Support/Editor/Bindings/EditorBindingStorageNormalizer.php - Kind:
class - Responsibility: Editor Binding Storage Normalizer.
Methods
public function __construct( private readonly BindingRegistry $registry, )- Constructor.
public function normalizeHtml(string $html): string- Normalize HTML into the canonical storage / render form.
protected function loadDocument(string $html): DOMDocument- Load Document.
protected function boundElements(DOMDocument $document): array- Bound Elements.
protected function resetElementForStorage(DOMElement $element): void- Performs
resetElementForStorageside effects.
- Performs
protected function resetImageElement(DOMElement $element): void- Performs
resetImageElementside effects.
- Performs
protected function resetUrlElement(DOMElement $element, string $tag): void- Performs
resetUrlElementside effects.
- Performs
protected function stripSpuriousDirectTextNodes(DOMElement $element): void- Card-style URL bindings only set href. Remove direct text nodes scraped from nested title/category copy in the editor.
protected function resetTextElement(DOMElement $element, string $sourceLabel, string $fieldLabel, string $tag): void- Performs
resetTextElementside effects.
- Performs
protected function extractBodyHtml(DOMDocument $document): ?string- Extract Body Html.
Voodflow\Voodbuilder\Support\Editor\Bindings\ModelIntegrationAuthBindingSource
- File:
Support/Editor/Bindings/ModelIntegrationAuthBindingSource.php - Kind:
class - Extends:
AbstractModelIntegrationBindingSource - Responsibility: Resolves fields from the currently authenticated user when the integration model is Authenticatable (typical use case: "Ciao {name}", profile links).
Methods
public static function supports(ModelIntegration $integration): bool- Supports.
public function id(): string- Stable identifier for this extension point.
public function label(): string- Human-readable label shown in the admin/editor UI.
public function fields(): array- Field definitions exposed for
data-voodbuilder-bind.
- Field definitions exposed for
public function resolve(string $fieldId, BindingContext $context): ?string- Resolve a runtime value for the given field / context.
Voodflow\Voodbuilder\Support\Editor\Bindings\ModelIntegrationBindingRegistrar
- File:
Support/Editor/Bindings/ModelIntegrationBindingRegistrar.php - Kind:
class - Responsibility: Model Integration Binding Registrar.
Methods
public function __construct( private readonly BindingRegistry $bindings, private readonly ModelIntegrationRegistry $integrations, )- Constructor.
public function register(ModelIntegration $integration): void- Performs
registerside effects.
- Performs
public function unregister(ModelIntegration $integration): void- Performs
unregisterside effects.
- Performs
public function refreshFromDatabase(): void- Performs
refreshFromDatabaseside effects.
- Performs
Voodflow\Voodbuilder\Support\Editor\Bindings\ModelIntegrationFieldTypeGuesser
- File:
Support/Editor/Bindings/ModelIntegrationFieldTypeGuesser.php - Kind:
class - Responsibility: Model Integration Field Type Guesser.
Methods
public static function guess(string $fieldId): string- Guess.
Voodflow\Voodbuilder\Support\Editor\Bindings\ModelIntegrationLatestBindingSource
- File:
Support/Editor/Bindings/ModelIntegrationLatestBindingSource.php - Kind:
class - Extends:
AbstractModelIntegrationBindingSource - Responsibility: Model Integration Latest Binding Source.
Methods
public function id(): string- Stable identifier for this extension point.
public function label(): string- Human-readable label shown in the admin/editor UI.
public function fields(): array- Field definitions exposed for
data-voodbuilder-bind.
- Field definitions exposed for
public function resolve(string $fieldId, BindingContext $context): ?string- Resolve a runtime value for the given field / context.
protected function resolveLatestRecord(): ?Model- Resolve Latest Record.
Voodflow\Voodbuilder\Support\Editor\Bindings\ModelIntegrationRegistry
- File:
Support/Editor/Bindings/ModelIntegrationRegistry.php - Kind:
class - Responsibility: Model Integration Registry.
Methods
public function register(ModelIntegration $integration): void- Performs
registerside effects.
- Performs
public function forget(ModelIntegration $integration): void- Performs
forgetside effects.
- Performs
public function findByAlias(string $alias): ?ModelIntegration- Find By Alias.
public function findByListKey(string $listKey): ?ModelIntegration- Find By List Key.
public function repeatCatalog(): array- id: string, label: string,
public function all(): array- All.