WordPress.org

Make WordPress Core

Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#49348 closed defect (bug) (fixed)

Block Editor: Include navigation block php file

Reported by: jorgefilipecosta Owned by: jorgefilipecosta
Milestone: 5.4 Priority: normal
Severity: normal Version: 5.4
Component: Editor Keywords: has-patch commit
Focuses: Cc:

Description

Currently, the core does not include the navigation block PHP files.
That happens because we missed changing the core files to copy the PHP file from npm and to include the file.
This PR fixes the issue referred, and now the navigation block is executed on the frontend. The block still does not work as expected and throws an error during frontend execution. A PR to fix this issue is available on the block editor side at https://github.com/WordPress/gutenberg/pull/19991/.
I tried this code replacing the navigation.php file with the one proposed on the PR and verified the block works as expected.
This patch adds the file as it is on the last version of the npm package. With the patch committed on the next package update, the navigation block will work as expected.

cc: @andraganescu

Attachments (3)

49348.diff (7.9 KB) - added by jorgefilipecosta 15 months ago.
49348.2.diff (7.5 KB) - added by jorgefilipecosta 15 months ago.
49348.3.diff (10.8 KB) - added by jorgefilipecosta 15 months ago.

Download all attachments as: .zip

Change History (10)

#2 @gziolo
15 months ago

  • Keywords commit added

I tested this patch and everything works as expected. I was able to insert Navigation block and apply some basic modifications. Code also looks correct!

#3 @jorgefilipecosta
15 months ago

  • Owner set to jorgefilipecosta
  • Resolution set to fixed
  • Status changed from new to closed

In 47176:

Block Editor: Include navigation block server logic.

Core did not include the navigation block PHP files.
This commit fixes the issue referred, and now the navigation block is executed on the frontend. The block still does not work as expected and throws an error during frontend execution. That problem is going to be fixed on the next WordPress package update.
This commit adds the file as it is on the npm package used.

Props gziolo.
Fixes #49348.

#4 @TimothyBlynJacobs
15 months ago

Should these function names be more specific? Or are they general utilities functions that should live somewhere else?

Thinking specifically about build_css_colors and build_css_font_sizes.

#5 @SergeyBiryukov
15 months ago

  • Milestone changed from Awaiting Review to 5.4

#6 @jorgefilipecosta
15 months ago

Hi @TimothyBlynJacobs, thank you for raising this point.
Here we are just including the navigation block as it is in the Gutenberg plugin, but I think these functions are very specific and should be renamed in the plugin (the change will propagate to core on the next package update).

#7 @andraganescu
15 months ago

Regarding the two functions mentioned by @TimothyBlynJacobs build_css_colors and build_css_font_sizes these are needed to extract color and font size CSS class / data because the block is using the new colors and fonts hooks.

While working on adding features to the PostAuthor block I have also needed the same functions and, for reasons of moving the PR ahead, just copied them, see the GitHub issue 19894

What would the solution be to have these as reusable code? Should we?

Last edited 15 months ago by andraganescu (previous) (diff)
Note: See TracTickets for help on using tickets.