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

[5.x] Prevent the Link Fieldtype's Asset option from erroring when container is empty #10270

Closed
wants to merge 1 commit into from

Conversation

duncanmcclean
Copy link
Member

This pull request fixes an issue where the Link Fieldtype would consider the "Asset" link option to be active, even when the container config value is an empty array.

This PR fixes it by using the empty function instead of just checking that it's not null.

Fixes #10268.

@morhi
Copy link
Contributor

morhi commented Jun 5, 2024

Hey @duncanmcclean :) I wonder if this really the right fix? To me it seems that the Dropdown component should not return an empty array, but null, if it is supposed to return one item only. Otherwise other references which use the return value of the Dropdown component might be broken, too, like my Addon :)

Edit: In Statamic 5.5.0 the fieldtype config() doesn't even contain the container property, if there is no asset container set. I think the null comparison is because the default config value is null if unset.

@duncanmcclean
Copy link
Member Author

Closing in favour of #10272.

@duncanmcclean duncanmcclean deleted the fix/link-fieldtype-asset-option-erroring branch June 5, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

link field causes 500 error if an asset container is not specified
2 participants