dynamic resolvers + theme code resolver#69
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Please make sure these boxes are checked before submitting your PR - thank you!
Changes
Dynamic Resolvers
Previously, the environment variable resolver was the only available resolver. This was not very flexible if one might want to add additional resolvers (either to this module or project-specific resolvers).
The
ImportProcessornow accepts an array with all resolvers that have been defined indi.xml.Each resolver must implement a
supportsmethod which checks whether a value or a config path matches certain criteria. If yes, the resolver will be called.If a value can not be resolved and should be skipped in the process, a
UnresolveableValueExceptionexception must be thrown by the resolver.Environment Variable Resolver
The prompting for missing environment variables has been moved to the resolver and is no longer part of the
ImportProcessor.Theme Code Resolver (NEW)
When assigning a theme to a website/store, Magento internally saves the ID of the selected theme in the config database table (path
design/theme/theme_id). Theme IDs might change but also hard-coding them in a config file is not recommended.Previously, there was no way to configure this value using this module. Now, you can use a specific syntax for theme codes in the configuration files. This is done with the syntax
%theme(path)%(after discussing with some people, I opted for a similar syntax like we already use for environment variables).For example, this might be the content of your config file:
The placeholder requires the theme path that is defined as component name in the
registration.phpfile of a Magento theme, e.g.frontend/Vendor/theme(never use justVendor/theme!).The module will check if this theme is available in Magento. If yes, the module will write the ID of the theme to the
core_config_datatable. If no theme with that path can be found, anUnresolveableValueExceptionexception will be thrown.