Skip to content

fix: render saved block background colors in Smarty (#318) - #387

Merged
PercolatingStudio merged 1 commit into
mainfrom
codex/issue-318-block-background-color
Nov 19, 2026
Merged

PercolatingStudio merged 1 commit into
mainfrom
codex/issue-318-block-background-color

Conversation

@PercolatingStudio

@PercolatingStudio PercolatingStudio commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Fixes #318

Reproduction on current main

Base: 70ae639964a3b1fcf945567a80eb7d1c73a425b1 (module 3.2.5).

  1. Install the current-main installable ZIP in an isolated shop.
  2. Add the built-in custom text block to displayHome.
  3. Save background #c62828, then reload the PrettyBlocks editor and open the front office.
  4. Expected: the saved background is visible in both the iframe and front office.
  5. Actual: the field persists, but both wrappers compute to transparent. The color is missing from $block.styles.

Reproduced via the actual BO on PrestaShop 8.2.7 / PHP 8.1.33 and 9.1.4 / PHP 8.5.0. Thanks to @Nathhhhhh for the report and @bc-devle for identifying the missing template style.

Minimal fix

  • Include the saved background in the existing $block.styles contract; no changes to field resolution, templates, schema, hooks, stored settings or default values.
  • Restrict values to safe plain CSS colors. Canonicalize RGB/HSL functions to whitespace-free comma notation so the generated attributes survive Smarty auto-escaping without adding nofilter.
  • Mark only these backgrounds, and reapply the marked color after responsive spacing replaces the inline style. Unmarked legacy/custom responsive backgrounds retain their existing behavior.

An initial quoted-attribute prototype was rejected by real Smarty/browser testing; it is not this patch.

Regression tests

  • PHP: 121 assertions, real model/field/spacing formatters, safe/unsafe input, unchanged stored defaults, byte-identical uncolored spacing output. Final test fails on current main and passes on the fix.
  • Node: 60/60 total; 6 new adaptive-style tests. The final new suite has 3 failures on main and 0 on the fix.
  • New tests are wired into the release builder/runtime test harness. The PR lab uses a trusted base harness, so the separate branch-only release-build workflow is also required to exercise this new harness.

Exact ZIP and functional matrix

Local candidate: prettyblocks-3.2.5.zip, SHA-256
c81494980d0d18b45db5ffd5758087173cb53aa83efa9662345c0c6ed642eb4e.

A local Docker registry-resolution failure prevented a fresh standard build. Because no Composer/Vite input changed, this candidate explicitly reuses the audited current-main ZIP payload and replaces only the two changed PHP/plain-JS files. This is a documented repack, not a claimed fresh build. Independent archive audit confirms 217 other files unchanged, root prettyblocks/, manifest and every referenced asset present, identical modes, no dev/test payload. GitHub must independently rebuild and install its own artifact before this PR is announced ready.

That exact candidate passed the repository install/smoke/PHP-lint/SCSS/dependency/asset checks on fresh PS8.2.7/PHP8.1 and PS9.1.4/PHP8.5 shops. Initialization was sequential to avoid local memory pressure; the initial simultaneous attempt was killed and is not counted as a pass.

Additional actual Smarty + Chromium tests on both versions:

  • BO save, reload, iframe/front color, then clear;
  • native renderZone → BlockPresenter → zone.tpl → built-in .tpl output: uncolored HTML 844 bytes, byte-for-byte identical before/after;
  • hex/name/RGB/RGBA/modern RGB/HSL/alpha colors and rejected injection strings;
  • desktop/tablet/mobile + legacy gap + repeated resize: background persists; existing 11/22/33px spacing behavior remains unchanged;
  • same-version native ZIP replacement preserves the test block's complete stored row and all 16 module hook registrations (snapshots identical before/after).

Scope and limits

  • Simple hex/named/RGB/HSL colors only; CSS variables, gradients and other modern color functions are deliberately not accepted.
  • An explicitly saved PrettyBlocks background takes precedence over a responsive background only on marked elements.
  • Existing 641–767px spacing gap and duplicated custom spacing attributes are unchanged/out of scope.
  • Same-version test ZIP swaps require clearing Smarty/CCC caches to load the new raw front script.
  • No version bump, main push, merge, tag or release. Percolating Studio metadata and all existing contributor credits are unchanged.

GitHub validation completed

All runs passed for head 802ce5ef7cd031898a1e359b526864d1482763f7:

The standard GitHub ZIP has SHA-256 1a7213870a11ad2413ad5f4be2e504c0f6d164c4abe5dfbe2f04868dcb45290c. Independent exhaustive comparison confirms its payload, all paths and modes match the locally functionally tested candidate exactly; only ZIP ordering/timestamps/extra fields differ. Shared canonical digest: cca5a8c04fc8c1af19ede8efc628095c98a4550e6ac41667e0fb01d73d6b5707.

Ready for Guillaume's human review, not automatically approved or merged. The builder/harness additions also require manual infrastructure review.

@PercolatingStudio
PercolatingStudio merged commit 6b572f5 into main Nov 19, 2026
7 checks passed
@PercolatingStudio
PercolatingStudio deleted the codex/issue-318-block-background-color branch November 19, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to modify anything in page builder

1 participant