Skip to content

Fix selector placeholders and allow clearing a selection - #389

Merged
PercolatingStudio merged 1 commit into
mainfrom
codex/issue-264-selector-default-and-clear
Nov 19, 2026
Merged

PercolatingStudio merged 1 commit into
mainfrom
codex/issue-264-selector-default-and-clear

Conversation

@PercolatingStudio

Copy link
Copy Markdown
Owner

Fixes #264.

Reproduction on main

On PrestaShop 8.2.7 / PHP 8.1 and PrestaShop 9.1.4 / PHP 8.5, register a PrettyBlocks block with a selector (collection Category). Opening its settings with 'default' => 'Choose' raises a PHP TypeError. With no default, reading the missing selection offsets raises a warning. A valid selection can be saved, but the picker offers no way to clear it.

Fix

  • Treat a string default as editor placeholder text, not a collection entry; without a placeholder, use the field label.
  • Add a clear button. An explicit empty marker keeps a structured default from silently reappearing after save/reload; ordinary empty values from existing callers keep their prior fallback behavior.
  • Keep existing structured selections and custom collection primary keys. The Smarty-facing selector is still a presented collection object or false; the marker is not exposed via settings_formatted or the theme-settings value.

Verification

  • The new PHP fixture fails against the baseline with the reproduced TypeError and passes against the candidate, including the no-lookup check for placeholders and cleared selectors.
  • The standard Docker builder produced a single installable ZIP used on both cores: SHA-256 0ef4672c37b714ac87591e832d4068ef5f3528f513aa2ac10512f5dda6db0c3a. Verified prettyblocks/, the Vite manifest and its assets.
  • Real editor and Smarty smoke test on both versions: Choose and no-default fields open, save, and reopen; select Art, save, clear it, reload, and select it again; repeat in one repeater row while preserving both row keys, the sibling selection, and adjacent text fields.
  • 54 Node tests passed. An isolated merge-tree sanity check with the related sidebar PR Fix selector-backed nameFrom sidebar titles #386 also passed its 189 title assertions; this PR does not include that change.
  • No version, schema, hook registration, or release change.

@PercolatingStudio
PercolatingStudio merged commit f76f310 into main Nov 19, 2026
3 checks passed
@PercolatingStudio
PercolatingStudio deleted the codex/issue-264-selector-default-and-clear 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.

Field type selector default value causes a bug

1 participant