-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[Pattern Directory]: Allow pattern registration from directory with theme.json #38323
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
Changes from 1 commit
3d68a4f
5d795ef
6741a08
2f1473c
0852d94
c435c6a
73c0d96
9cca636
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -680,12 +680,13 @@ public function get_custom_templates() { | |
| * Returns the current theme's wanted patterns(slugs) to be | ||
| * registered from Pattern Directory. | ||
| * | ||
| * @return array|null | ||
| * @return array | ||
| */ | ||
| public function get_patterns() { | ||
| if ( isset( $this->theme_json['patterns'] ) && is_array( $this->theme_json['patterns'] ) ) { | ||
| return $this->theme_json['patterns']; | ||
| } | ||
| return array(); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of copying the entire file to lib/compat/wordpress-6.0, should we instead keep the original file under The advantage of this is that we know exactly what's on 5.9 and what was added on 6.0
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems in many cases including this one, this is quite hard due to private functions and properties. In this case for making it work we need to override the I then tried to move more functions to the new child class but we have so many private functions/properties there used, that we would need to move so much code there, changing the names(prefix I think we cannot avoid this easily - at least from what I could see, and maybe we should copy the whole class as is here in What do you think? Am I missing something php related?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like the problem here is the change in For now, I guess we don't have any other option than copying everything 🤷
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally, I think each PR should add its own needed changes, if we can land this without copying everything, I'd do that. If we need to make another change later, we'll need to figure how to do it at that point.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if we add a couple of filters to the JSON parser in WP-Core for 5.9.1?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's the thing though, the way I see it it as I explained above, we cannot avoid copying the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @youknowriad @ntsekouras I haven't yet dug into an alternative way to extend this. I'll do it later. I wanted you to be aware that in https://github.com/WordPress/gutenberg/pull/37140/files#r801650187 we'll need to change from Perhaps we can do similar modifications to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The required changes in core for this to work with a child class that changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.