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

Particles in their own subdir show a non-descriptive error on Layout save with Grav #3191

Open
fcFn opened this issue Oct 20, 2023 · 2 comments

Comments

@fcFn
Copy link

fcFn commented Oct 20, 2023

Description

If you try to put particles into their own subfolder e.g. particles/my-particle on Grav, Gantry will crash at preg_match() with Unknown modifier: m on layout save.

Steps to reproduce:

  1. Follow the steps in the docs for Grav.
  2. Create a subdirectory, e.g. /particles/my-particle, and put your particle files there.
  3. Use the particle in the Layout editor and save the layout.

Expected behavior:

It should either save the layout without throwing an exception or display a better error message that would indicate what should be fixed such as "Please make sure your particle files are inside the root of the particle directory".

Possible fixes:

  • Make it possible to put particles into their own directories (Fix #3191 #3192 makes the layout save and work, but options for particles in dirs still won't work).
  • Mention in the docs that particle files should be in a flat directory and either make the error message more descriptive or do not show the particles inside subdirectories in the Layout editor.
fcFn added a commit to fcFn/gantry5 that referenced this issue Oct 20, 2023
@fcFn fcFn mentioned this issue Oct 20, 2023
@N8Solutions
Copy link

Just my 2-cents here @fcFn. The documentation doesn't discuss the ability to place a particle into it's own subfolder under the TEMPLATE_DIR/custom/particles folder so the expected behavior is that this would fail, not that it would work.

So you're proposed "fix" isn't actually a fix, but rather it is considered to be an enhancement. If the files for the particles were all under one folder, i.e. .scss .yaml .twig & .js (if needed) then I could understand this but since those files are all under separate folders, I don't find your proposed enhancement necessary.

Can you provide a good case for the reasoning behind wanting to do this? I'm honestly curious because under the /particles folder there are only 2 files per particle, the .twig and the .yaml files.

@fcFn
Copy link
Author

fcFn commented Oct 20, 2023

@N8Solutions You're right. Perhaps it should just fail with a better message instead of what it does now, such as "Please make sure your particle files are inside the root of the particles directory" (this is on Grav by the way, I'll edit the post). Or maybe it should be mentioned that particles has to be a flat directory in the docs.

@fcFn fcFn changed the title Particles in their own subdir show a non-descriptive error on Layout save Particles in their own subdir show a non-descriptive error on Layout save with Grav Oct 20, 2023
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