Slug based folder structure when not using title field
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
Description
I am having an issue with the folder structure in assets in certain scenarios. For certain projects I quite often set the default asset upload location as the {slug} of the the entry to make it a little bit more manageable. I am having an issue on a site currently where I am not using the title field and instead using custom 'firstName' and 'lastName' fields. When I create a new entry and haven't yet saved the entry, any uploaded assets seem to generate a temp folder and get uploaded there instead of under the slug. This is only an issue when not using the title field.
Steps to reproduce
- Create a section which uses alternative plain text fields instead of title field
- Add an asset field which uses the {slug} as the default folder structure
- Create a new entry
- Before saving the new entry add an image to the asset field
Additional info
- Craft version: Craft Pro 4.5.6.1
- PHP version: 8.1.21
- Database driver & version: MySQL 8.0.33
- Plugins & versions:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce this in Craft Pro 4.5.6.1 by creating a section with custom firstName and lastName fields, configuring an asset field with a {slug} folder structure, and uploading an image before saving. Done means the unsaved entry's asset is placed in the intended slug-based folder rather than a temporary folder; compare behavior with a section that uses the title field.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, content
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100