Conditions

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\Conditions\EditorConditionHooks

  • File: Support/Editor/Conditions/EditorConditionHooks.php
  • Kind: class
  • Responsibility: Editor Condition Hooks.

Methods

  • public static function register(string $key, callable $handler): void
    • Performs register side effects.
  • public static function registerChoiceProvider(string $key, callable $provider): void
    • Performs registerChoiceProvider side effects.
  • public static function evaluate(string $key, array $condition, ?SitePage $page): ?bool
    • Evaluate.
  • public static function options(): array
    • Options.

Voodflow\Voodbuilder\Support\Editor\Conditions\EditorConditionsAttributeNormalizer

  • File: Support/Editor/Conditions/EditorConditionsAttributeNormalizer.php
  • Kind: class
  • Responsibility: Editor Conditions Attribute Normalizer.

Methods

  • public static function normalize(string $html): string
    • Normalize markup or attributes into the canonical storage form.
  • public static function parseDefinition(string $raw): ?array
    • Parse Definition.
  • public static function encodeDefinition(array $definition): string
    • Encode Definition.
  • protected static function normalizeDefinitionShape(array $decoded): array
    • Normalize Definition Shape.
  • protected static function loadDocument(string $html): DOMDocument
    • Load Document.
  • protected static function conditionElements(DOMDocument $document): array
    • Condition Elements.
  • protected static function pruneCorruptedJsonAttributes(DOMElement $element): void
    • Editor corrupts JSON condition payloads into stray attributes.
  • protected static function extractBodyHtml(DOMDocument $document): ?string
    • Extract Body Html.

Voodflow\Voodbuilder\Support\Editor\Conditions\EditorElementConditionEvaluator

  • File: Support/Editor/Conditions/EditorElementConditionEvaluator.php
  • Kind: class
  • Responsibility: Editor Element Condition Evaluator.

Methods

  • public function passes(array $definition, ?SitePage $page = null, array $context = []): bool
    • Passes.
  • protected function setPasses(array $set, ?SitePage $page, array $context = []): bool
    • Set Passes.
  • protected function conditionPasses(array $condition, ?SitePage $page, array $context = []): bool
    • Condition Passes.
  • protected function resolveActualPagePath(array $context): string
    • Resolve Actual Page Path.
  • protected function normalizePagePathValue(string $path): string
    • Normalize Page Path Value.
  • protected function compareBool(bool $actual, string $compare, bool $expected): bool
    • Compare Bool.
  • protected function compareRole(string $compare, string $role): bool
    • Compare Role.
  • protected function comparePagePath(string $actual, string $compare, string $expected): bool
    • "/" is a substring of every path — "contains /" must mean homepage only.
  • protected function compareString(string $actual, string $compare, string $expected): bool
    • Compare String.
  • protected function compareRouteName(string $compare, string $expected): bool
    • Compare Route Name.
  • protected function compareDateBefore(string $value): bool
    • Compare Date Before.
  • protected function compareDateAfter(string $value): bool
    • Compare Date After.
  • protected function truthy(mixed $value): bool
    • Truthy.

Voodflow\Voodbuilder\Support\Editor\Conditions\EditorElementConditionRenderer

  • File: Support/Editor/Conditions/EditorElementConditionRenderer.php
  • Kind: class
  • Responsibility: Editor Element Condition Renderer.

Methods

  • public function __construct( private readonly EditorElementConditionEvaluator $evaluator, )
    • Constructor.
  • public function render(string $html, ?SitePage $page = null): string
    • Render stored markup for the current context.
  • protected function stripConditionAttributes(string $html): string
    • Strip Condition Attributes.
  • protected function loadDocument(string $html): DOMDocument
    • Load Document.
  • protected function conditionElements(DOMDocument $document): array
    • Condition Elements.
  • protected function parseDefinition(string $raw): ?array
    • Parse Definition.
  • protected function extractBodyHtml(DOMDocument $document): ?string
    • Extract Body Html.

Voodflow\Voodbuilder\Support\Editor\Conditions\LogicalRouteName

  • File: Support/Editor/Conditions/LogicalRouteName.php
  • Kind: class
  • Responsibility: Normalize locale-prefixed route names for editor conditions and visibility rules.

Methods

  • public static function normalize(string $routeName): string
    • Normalize markup or attributes into the canonical storage form.
Demo resets in 00:29:37