Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reliance on gutenberg_get_editor_styles() #508

Closed
dd32 opened this issue Jul 21, 2022 · 2 comments · Fixed by #510
Closed

Remove reliance on gutenberg_get_editor_styles() #508

dd32 opened this issue Jul 21, 2022 · 2 comments · Fixed by #510
Assignees
Labels
[Component] Pattern Creator Anything related to the pattern front end editor or preview [Type] Bug Something isn't working

Comments

@dd32
Copy link
Member

dd32 commented Jul 21, 2022

Describe the bug
As of WordPress/gutenberg#41306 gutenberg_get_editor_styles() is no longer in Gutenberg 13.7 (Released 7hrs ago), but it's used within the Pattern Creator:

$custom_settings = array(
'postId' => $post_id,
'siteUrl' => site_url(),
'postsPerPage' => get_option( 'posts_per_page' ),
'styles' => gutenberg_get_editor_styles(),
'__experimentalBlockPatterns' => array(),
'__experimentalBlockPatternCategories' => array(),
);

This was noticed via a fatal error in production in the pattern creator on https://wordpress.org/patterns/new-pattern/:
Uncaught Error: Call to undefined function WordPressdotorg\Pattern_Creator\gutenberg_get_editor_styles() in wp-content/plugins/pattern-creator/pattern-creator.php:142

It's worth noting that the removed file, gutenberg/lib/compat/wordpress-5.9/edit-site-page.php IS present in the version of Gutenberg currently in use on the pattern directory.

Unable to reproduce at a glance, but looks like if it's not currently an issue, it will be in a future gutenberg release when that file is removed. reproduced, I had an old Gutenberg version installed on my test site 🤦

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@dd32
Copy link
Member Author

dd32 commented Jul 21, 2022

Noting that in #509 I just copied the function from Gutenberg 13.6 to the Pattern Directory, quick fix to resolve the fatals, requires some more digging to find the Gutenberg replacement function.

@ryelle
Copy link
Contributor

ryelle commented Jul 21, 2022

Looks like this was replaced with get_block_editor_theme_styles — I'm not sure why I stuck with the older function when I have updated others, but hopefully this can be a drop-in replacement.

@ryelle ryelle self-assigned this Jul 21, 2022
ryelle added a commit that referenced this issue Jul 21, 2022
Remove the forked `gutenberg_get_editor_styles`, and use the core version `get_block_editor_theme_styles`.

Fixes #508.
@ryelle ryelle added [Type] Bug Something isn't working [Component] Pattern Creator Anything related to the pattern front end editor or preview labels Jul 21, 2022
ryelle added a commit that referenced this issue Jul 21, 2022
Remove the forked `gutenberg_get_editor_styles`, and use the core version `get_block_editor_theme_styles`.

Fixes #508.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Pattern Creator Anything related to the pattern front end editor or preview [Type] Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants