Skip to content
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

Partial tag subdirectory code incorrect #2985

Closed
ellukesmith opened this issue Dec 9, 2020 · 4 comments
Closed

Partial tag subdirectory code incorrect #2985

ellukesmith opened this issue Dec 9, 2020 · 4 comments

Comments

@ellukesmith
Copy link

Bug Description

The partials tag allows you to specify a path, but it also contains code to automatically load anything in the 'partials' directory if not found. This code is currently incorrect, as it replaces slashes with a period, but doesn't convert back to slashes when checking the partials directory.

How to Reproduce

Try to include a file in the partials directory without including the 'partials' dir in the include.
{{ partial:partial_name }}

Extra Detail

The screenshot below shows the line 31 in the Partial tag file checking if 'partials.'.$partial exists, but it needs to run it through underscoredViewName, otherwise it doesn't add the slash back in.
Screen Shot 2020-12-09 at 10 41 29 am

Environment

Statamic 3.0.30 Pro
Laravel 8.15.0
PHP 7.3.24

Install method (choose one):

  • Fresh install from statamic/statamic
@jasonvarga
Copy link
Member

It seems to work fine. I can't see a problem with the code. Can you provide any more details?

@ellukesmith
Copy link
Author

ellukesmith commented Dec 9, 2020

I think the wording in the docs threw me off here.

The docs recommend to put an underscore before each partial, so my assumption was this would also apply even if storing the partials in a partials directory. The current code doesn't work if the files in a partials directory start with an underscore.

Is the expected behaviour that partials in a partials dir don't start with an underscore? If so, it probably just needs a note added to the docs about this.

@robdekort
Copy link
Contributor

Hey the docs state that the views need to be prefixed. In the example I don't see it saying the folders need an underscore. Let me know where it throws you off and I'll PR the docs to make it more clear.

@jasonvarga
Copy link
Member

See statamic/ideas#305 where exactly this has been requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants