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

template field lists underscore files in subfolders #7922

Open
Puddingboy opened this issue Jul 8, 2021 · 2 comments
Open

template field lists underscore files in subfolders #7922

Puddingboy opened this issue Jul 8, 2021 · 2 comments

Comments

@Puddingboy
Copy link

Details

Question Answer
Relevant Bolt Version 5.3.2
Install type Composer install
BC Break yes/no
PHP version 7.3
Web server Apache / Nginx / Built-in, version [ version ] < really?
For UX/UI issues Brave > Chromium <<<< really this doesnt matter here

Reproduction

If you're filing a bug, please describe how to reproduce it. Include as much
relevant information as possible, such as:

Bug summary

template field is expected to filter out partial twig files prefixed with underscores like so:
_demo.twig
this doesn't happen if the partial is located in a subfolder
this probably happens because the parser tests the relative path rather than the individual filename.
127 0 0 1_8000_bolt_edit_10 (1)

I also created a copy of listing.twig renamed to _listing.twig, stored on the same folder lvl. This one is properly filtered. subfolders are ignored.

Specifics

It's a simple issue. doesn't get more specific than this.

Steps to reproduce

have subfolders in theme with twig files prefixed with _. This should already exist as is in bolt.

Expected result

filtered list without _name.twig files

Actual result

poorly filtered list still contains _file.twig if they exist in subfolders

@I-Valchev
Copy link
Member

Hi @Puddingboy ,

Thanks for the detailed PR. I think it has to do with the default filter option. You can also override it to something else if you find it more suitable, here's the documentation:
https://docs.bolt.cm/4.0/fields/templateselect#options

@Puddingboy
Copy link
Author

Puddingboy commented Jul 15, 2021

I would think the glob filter should match the default partials. /^(?!partials)[^_].*\.twig$/ worked for me.
the pattern can be extended to other folders with (?!(folder1|folder2).

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

No branches or pull requests

2 participants