-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Patterns: show theme patterns from directory in site editor #55877
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6aca0b3
Show theme patterns from the directory in the site editor patterns page
glendaviesnz 316bc22
Rename constant
glendaviesnz 3106b51
Switch constant name again
glendaviesnz f518f6c
Lets try that again
glendaviesnz 0a0dbfe
Rename method and update comment
glendaviesnz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this makes the
PATTERN_CORE_SOURCES
variable name no longer true, so perhaps the variable needs to be renamed as well (EXCLUDED_LIBRARY_SOURCES
?), or the filtering could be done a different way.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it actually applies better now as previously it included theme specified patterns from the directory which are essentially theme patterns rather than core, now it is more strictly just core patterns that are not related to the current theme at all.
Having looked at the places where
PATTERN_CORE_SOURCES
is currently used the name still seems to fit in the context - but happy to rename if you still think it is not a suitable name.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @talldan on the naming here.
The source of the patterns is core and the pattern directory, not the theme. The theme doesn't create or define the patterns, it only "opts into" using them, which doesn't change their actual source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it confuses things to not think of these as theme patterns - from the user perspective they are a theme pattern regardless of the source, but I will try and come up with a name for the constant that better reflects the situation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Luckily, we're referring to a variable name here that isn't exposed to users, so we can afford to be accurate.
We could also argue that for most users they only see patterns, not user, theme, or core patterns etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the new naming of
NON_THEME_PATTERN_SOURCES
introduced in 316bc22 is any better thanPATTERN_CORE_SOURCES
. As discussed, the source is still the pattern directory not the theme, soNON_THEME_PATTERN_SOURCES
should still includepattern-directory/theme
in my view.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have renamed the constant to
NON_THEME_PATTERN_SOURCES
, which makes the nature of it a bit clearer in the contexts it is used I think, eg.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dan's suggested name
EXCLUDED_LIBRARY_SOURCES
sidesteps most of the discussed issue by naming the array by its purpose. It might require an extra tweak to an inline comment and variable but that's neither here nor there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have updated that inline comment and variable