Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Backport new WP_Theme_JSON::get_patterns() method.
  • Loading branch information
hellofromtonya committed Apr 7, 2022
commit 0af20586a96187e1307916db453536ff0fca361b
15 changes: 15 additions & 0 deletions src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,21 @@ public function get_template_parts() {
return $template_parts;
}

/**
* Returns the current theme's wanted patterns(slugs) to be registered from
* Pattern Directory.
*
* @since 6.0.0
*
* @return array Array of patterns if configured, else empty array.
*/
public function get_patterns() {
if ( isset( $this->theme_json['patterns'] ) && is_array( $this->theme_json['patterns'] ) ) {
return $this->theme_json['patterns'];
}
return array();
}

/**
* Converts each style section into a list of rulesets
* containing the block styles to be appended to the stylesheet.
Expand Down