Make WordPress Core

Opened 7 months ago

Closed 7 months ago

Last modified 5 months ago

#62399 closed defect (bug) (fixed)

Theme JSON: include block style variations in path only output of get_block_nodes

Reported by: ramonopoly's profile ramonopoly Owned by: ramonopoly's profile ramonopoly
Milestone: 6.8 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch, has-unit-tests, gutenberg-merge
Focuses: Cc:

Description

Follow up to https://core.trac.wordpress.org/ticket/61858.

In https://github.com/WordPress/wordpress-develop/pull/7486, an $include_node_paths_only option was added to get_block_nodes() to improve performance.

When true this option tells the function to only return paths, and not selectors, for consumers that only needed paths to style values.

For one of the conditional blocks, block style variations wasn't included.

Priority is low (can be included in 6.8) since the flag only used in one place for now (WP_Theme_JSON:merge) and only in the context of merging background images, which do not yet support block style variations.

Change History (6)

This ticket was mentioned in PR #7784 on WordPress/wordpress-develop by @ramonopoly.


7 months ago
#1

Syncing Gutenberg PR:

Follow up to:

Including variations in the nodes array when 'include_node_paths_only' => true

Discussed here: https://github.com/WordPress/gutenberg/pull/66731/files#r1830311575

## Why?
https://github.com/WordPress/gutenberg/pull/66002 added and $include_node_paths_only option to get_block_nodes() to improve performance.

When true this option tells the function to only return paths, and not selectors, for consumers that only needed paths to style values.

For one of the conditional blocks, block style variations wasn't included.

This PR adds them to the array of paths following the existing model $node[]['path' => [], 'variations' => ['path' => []]]

## How?
Just adding the same loop but in the $include_node_paths_only condition block.

## Testing Instructions

PHP unit tests should pass.
Smoke test the editor. Should be all 👍🏻

Trac ticket: https://core.trac.wordpress.org/ticket/62399

#2 @ramonopoly
7 months ago

  • Milestone changed from Awaiting Review to 6.8

@ramonopoly commented on PR #7784:


7 months ago
#3

Thanks for testing @aaronrobertshaw!

#4 @ramonopoly
7 months ago

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

In 59418:

Theme JSON: include block style variations in path only output of get_block_nodes

An $include_node_paths_only option to get_block_nodes() was introduced to improve performance.

When set to true, this option tells the function to only return paths, and not selectors, for consumers that only needed paths to style values.

For one of the conditional blocks, block style variations wasn't included.

This commit adds them to the array of paths following the existing model $node[]['path' => [], 'variations' => ['path' => []]].

Follow-up to [61858].

Props aaronrobertshaw, ramonopoly.
Fixes #62399.

@ramonopoly commented on PR #7784:


7 months ago
#5

Committed in r59418 / dec5c906459c5cdebe7630fb6a61bcbf3e4344b9

#6 @joemcgill
5 months ago

  • Keywords gutenberg-merge added
Note: See TracTickets for help on using tickets.