[5.5] Check for vendor views for each paths given in config/view.php #21636
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.
Currently I'm working on a project that requires a theme style views environment. There are multiple themes developed by a third party that only has access to themes folder. It's known what packages are used and views are included(e.g. laracasts/flash, backpack etc.). Those views can be different/changed per theme. But not thats not possible in the current situation.
In the current version of Laravel only the local
resources/view/vendor/
folder will be checked for "Package Views".Problem
When having multiple view paths in
config/view.php
or different location of the view path the "Package views" extending will not work.Example:
Each time the
loadViewsFrom
method will be used it only checks inresources/views/vendor/$namespace
and it is not loading fromthemes/vendor/$namespace
.Another example:
Different location will not be checked for extensions
storage/themes/theme1/vendor/$namespace
.Solution
The fix/solution is backwards compatible and can be pushed to earlier version of Laravel aswel.
Instead of only looking for
$this->app->resourcePath().'/views/vendor/'.$namespace
in theloadViewsFrom
method, loop through all view paths and check if there is avendor/$namespace
within the directory.