Skip to content

Pattern Overrides: Image block doesn't render on frontend when it's saved as a placeholder in a pattern #58425

@talldan

Description

@talldan

Description

See the title and the steps to reproduce.

This seems to happen because the image block saved in the pattern doesn't have complete markup (because no image is set). The image block also dynamically renders nothing in its php render callback when it detects there's no image.

The server html replacement that pattern overrides uses can't reproduce block markup, so this causes a problem.

Step-by-step reproduction instructions

  1. Create a synced pattern that contains an image block (but don't add an image to the image block)
  2. Use the image block as a pattern override using the checkbox in the advanced section
  3. Save the pattern
  4. Create a new post, insert an instance of the pattern you just created
  5. Add an image to the image block in the pattern
  6. Preview the post

Expected: the image set in step 5 should render
Actual: the image doesn't render.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] ImageAffects the Image Block[Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions