plain-solutions-gmbh / kirby-form-block-suite

This form plugin for Kirby offers you maximum flexibility and usability. It can be used as a block anywhere you needed. This repository replaces the obsolete version 2.0.
Other
38 stars 11 forks source link

Directory read error when hidden file is present in custom formfield folder - Local - MacOS #34

Closed jeanfrancoisbeaulieu closed 7 months ago

jeanfrancoisbeaulieu commented 7 months ago

After testing some things with a custom formfield and deleting the field .yml file in "site/theme/blueprints/blocks/formfields/", a hidden/special file (.DS_Store) was created in the folder by the OS.

This file is read by foreach (Dir::read($formblockfolder, [], true) as $f) { in mergeFormfields() inside FormBlueprint.php and throws an empty array error.

Adding a custom ignore: foreach (Dir::read($formblockfolder, ['.DS_Store'], true) as $f) { removes the error.

I'm not sure if this is specific to my local dev setup (macOS + MAMP) and how the Kirby Dir::read regular ignore are supposed to work (['.', '..']). Maybe this error should be directed at Kirby. Let me know what you think.

Thank you.

MacOS 12.6.9 Chrome 120.0.6099.109 MAMP 6.6 PHP 8.0.8

plain-solutions-gmbh commented 7 months ago

Thanks for reporting. I could reproduce it and forward it to the kirby core team.

My test environment: MacOS 14.2 Brave v1.61.114 MAMP 6.8.1 PHP 8.1.13

plain-solutions-gmbh commented 7 months ago

Following Ahmet's advice, I have adapted the following line in the repository:

https://github.com/youngcut/kirby-form-block-suite/blob/d6c50b70a3aea2330a80e3eb9c958b36a2664507/classes/FormBlueprint.php#L192

Thank you.