Skip to content

fix(wp): load the Bricks BEM generator after the builder connector - #16

Merged
DavidBabinec merged 1 commit into
mainfrom
fix/bricks-bem-generator-init
Aug 18, 2026
Merged

fix(wp): load the Bricks BEM generator after the builder connector#16
DavidBabinec merged 1 commit into
mainfrom
fix/bricks-bem-generator-init

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

The bug

Auto BEM stopped appearing in the Bricks structure panel after updating to
2.0.0. Older versions are unaffected. The settings toggle still shows and the
script still ships, so nothing looks wrong until you hover an element.

bricks_bem_generator.js reads window.core_framework_connector once, at
execution, and never retries. 43ab5899 moved the connector to the footer by
adding $in_footer = true, while the generator stayed registered with
false. The generator ran in the head, read an undefined object, its gate
failed, and it never initialised. The connector then appeared in the footer
with nothing left to read it.

It is the only connector-reading script still loading in the head, which is
why every other Bricks feature kept working.

The fix

Register the generator in the footer and declare the connector as a
dependency, so the order is pinned rather than left to placement.

Verification

php -l Bricks.php    # No syntax errors detected
bun run php-test     # OK (28 tests, 52 assertions)

The generator reads window.core_framework_connector once, at execution,
and never retries. 2.0.0 moved that connector to the footer while the
generator stayed in the head, so it read an undefined object, its gate
failed, and the BEM icon never appeared in the structure panel.

Declaring the dependency pins the order rather than relying on footer
placement alone.
@DavidBabinec
DavidBabinec merged commit dea7fcc into main Aug 18, 2026
6 checks passed
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.

1 participant