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

Default asset value is not used for an asset field when no asset URL is defined or provided. #1493

Closed
jamesmacwhite opened this issue Aug 14, 2024 · 1 comment
Labels

Comments

@jamesmacwhite
Copy link
Contributor

Description

I don't know if this is the intended behaviour, but when setting a default asset value, when an asset field does not get provided a URL to import from, I was expecting the default asset to be assigned. This however does not appear to happen, but it might not be actually intended to use this way. I can use the "Use default value", but in most cases an asset URL is provided hence I don't want to do this.

Steps to reproduce

  1. Import to an asset field using a URL
  2. Set a default asset value
  3. When an asset URL value is not provided no fallback i.e. default value is used

Additional info

  • Craft version: 5.3.4
  • PHP version: 8.3
  • Database driver & version: MySQL
  • Plugins & versions: Feed Me 6.2.1
@i-just
Copy link
Contributor

i-just commented Aug 30, 2024

Hi, I’m not sure if I understand you correctly, so please let me know if I missed your point.

I have just tested the following json feed

{
  "entries": [
    {
      "title": "asset1",
      "myAsset": "https://placehold.co/600x400.png"
    },
    {
      "title": "asset2",
      "myAsset": ""
    }
  ]
}

where the assets field is mapped to myAsset and a default is provided, like so:
Screenshot 2024-08-30 at 10 56 57

With the above, the asset2 entry gets the default asset assigned to it. However, if I remove "myAsset": "", the default won’t be used.

The above is expected behaviour. If the mapped key is not in the feed, then no value will be set for the field.

I hope this helps clarify things. I’ll close this now, but feel free to reply if I missed your point or if anything’s unclear.

@i-just i-just closed this as completed Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@i-just @jamesmacwhite and others