craftercms / craftercms

Parent project for Crafter CMS. Issue tracking across all repositories and global builds.
GNU General Public License v3.0
282 stars 98 forks source link

Validate macros in Content Type form before saving #6707

Open Euquimides opened 3 weeks ago

Euquimides commented 3 weeks ago

Duplicates

Latest version

Describe the issue

When creating Content Types, we are not validating if the macros being added (such as {year}, {month}, {objectId}) exists or not. We should validate that the macros being added is indeed supported, before saving and closing the edition or creation of the Content-Type.

For example objectId and parentPath are macros that according to the documentation are supported, but are not working right now.

Steps to reproduce

Steps:

  1. Create a new project based in Editorial
  2. Go to Project Tools > Content Types > Article.
  3. Edit "Destination Path Pattern" to include {objectId} macros.
  4. Save the Content Type.
  5. Go to quick create menu and create a new article.
  6. See the issue: a folder named -objectid- is created, instead of the ID of the item.

Relevant log output

No response

Screenshots and/or videos

Screenshot from 2024-04-23 11-50-50

sumerjabri commented 1 week ago

Some customers use custom macros. @rart, please think of a design that supports custom macros or does not prevent them from working.

Euquimides commented 2 days ago

Hi @jvega190 ! While reviewing the fix for this ticket, I noticed that in the case of {objectGroupId}, {objectGroupId2}, {parentPath[index]} the validation is not working as with {objectId} and {parentPath}, since it still saves the macros in the Content Type form. Can you please check this out? Thank you!

jvega190 commented 1 day ago

@Euquimides please note that for {parentPath[index]} macro, index is an actual number. e.g: parentPath[2]. For objectGroupId/objectGroupId2, I'll send an update to validate those too