Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#55574 closed enhancement (fixed)

WP_REST_Pattern_Directory_Controller::get_items doesn't support array arguments

Reported by: antonvlasenko's profile antonvlasenko Owned by: antonvlasenko's profile antonvlasenko
Milestone: 6.0 Priority: normal
Severity: normal Version: 5.8
Component: REST API Keywords: has-patch
Focuses: rest-api Cc:

Description

Since http://api.wordpress.org/patterns API supports array parameters, there is no need to implode slug values inside the _register_remote_theme_patterns function.
Both WP_REST_Pattern_Directory_Controller and _register_remote_theme_patternsmust be updated to support array request arguments.

Change History (6)

This ticket was mentioned in PR #2591 on WordPress/wordpress-develop by anton-vlasenko.


3 years ago
#1

  • Keywords has-patch added

#2 @antonvlasenko
3 years ago

Steps to test the PR:

  1. Activate a block-based theme like Twenty Twenty-Two.
  2. Open the theme.json file for that theme and add a new patterns setting to it:
    "patterns": [
    	"short-text-surrounded-by-round-images",
    	"visual-navigation-with-rainbow-gradient"
      ],
    

You can use any pattern instead of the patterns above. However, it's important to use at least 2 patterns.
A list of available patterns can be found here: https://wordpress.org/patterns/

  1. Make a GET call to this REST API endpoint:

/wp/v2/block-patterns/patterns
Expected result:
The response must contact patterns added in step 2.
E.g.:
https://cldup.com/VHZlrnyQMm.png

#4 @gziolo
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 53218:

REST API: Add array argument to getItems for Pattern Directory endopoint

Since http://api.wordpress.org/patterns API supports array parameters, there is no need to implode slug values inside the _register_remote_theme_patterns function.
Both WP_REST_Pattern_Directory_Controller and _register_remote_theme_patternsmust be updated to support array request arguments.

Props antonvlasenko.
Fixes #55574.
Follow-up #55505, [53152].

#6 @costdev
3 years ago

  • Milestone changed from Awaiting Review to 6.0
  • Version changed from trunk to 5.8
Note: See TracTickets for help on using tickets.