Skip to content

fix(php-transformer): carry social icon color into shared header parts - #2240

Merged
chubes4 merged 1 commit into
trunkfrom
fix/header-part-social-icon-color
Sep 26, 2026
Merged

chubes4 merged 1 commit into
trunkfrom
fix/header-part-social-icon-color

Conversation

@chubes4

@chubes4 chubes4 commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Problem

After #2234, uniformly coloured social icons in page content render with the authored colour, but a shared header extracted to a template part still emits core/social-links without iconColorValue. Pages that use that part keep core's per-service brand colours.

Root cause

The colour carry reads a monochrome glyph from asset metadata keyed for the compiling document. A root-relative icon URL matches that map on the entry document, whose directory is the web root, and misses it on every nested document. Shared-shell extraction then takes the dominant nested-page header, so the template part never receives the colour. Isolated shared-shell compilation also never received the payload reader the page path uses to sample referenced glyphs. Placeholder icons in the extracted header (a 1×1 stand-in for the same destination) had no local pixels to sample even when the real glyph was elsewhere in the document.

Fix

Extend the existing glyph-colour primitive, without a second mechanism:

  • Index each image under its web-root URL so every document resolves the same root-relative glyph.
  • Give isolated shared-shell compilation the same payload reader the page path already uses.
  • When a local icon image has no authored paint, reuse the monochrome colour of another image for that same destination.

Regression test

php tests/unit/social-links-icon-color.php

Fails before the fix:

FAIL: a shared header template part carries the root-relative glyph color, got <!-- wp:social-links {"className":"social-links is-style-logos-only blocks-engine-source-social-item-spacing","size":"small"} -->
EXIT:1

Passes after:

Social-links icon color tests passed

The added cases cover an embedded root-relative glyph, placeholder icons that share a destination with a real glyph, and a payload-referenced staged import. Mixed icon colours still leave core service colours alone.

Verification

Fresh import of the private capture with Static Site Importer origin/main @ 6f0eff4 and this branch @ 6424fc2. The dev-package ZIP vendors the change (sameDestinationGlyphColor, web-root lookup key, shared-shell payload reader).

Inner page that renders the header template part, 1440px, three header icons, 20×24 at x 1248 / 1278 / 1308, y 213 on both sites:

baseline this branch
first rgb(255, 0, 0) rgb(255, 255, 255), has-icon-color
second rgb(240, 0, 117) rgb(255, 255, 255), has-icon-color
third rgb(8, 102, 255) rgb(255, 255, 255), has-icon-color

Source header icons at the same x positions are 20×20 white glyphs. At 390 both sites collapse the header icons to 0×0; computed colour stays the brand colours on the baseline and rgb(255, 255, 255) here. parts/header.html now has one wp:social-links with iconColorValue #ffffff.

Also passed: php tests/unit/social-links-boundary.php, php tests/contract/shared-shell-plan.php.

Fixes #2238

AI disclosure: implemented by xAI Grok 4.7 via OpenCode (opencode run), orchestrated and reviewed by Claude (Anthropic).

@chubes4
chubes4 marked this pull request as ready for review September 26, 2026 01:02
@chubes4
chubes4 merged commit eb545da into trunk Sep 26, 2026
10 checks passed
@chubes4
chubes4 deleted the fix/header-part-social-icon-color branch September 26, 2026 01:02
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.

Header template part social-links lose authored icon colour (content path is fixed, shared-shell path is not)

1 participant