Skip to content

[6.x] Add default initial option configuration option for Link fieldtype#14698

Open
martyf wants to merge 1 commit into
statamic:6.xfrom
martyf:feature/link-fieldtype-default-type
Open

[6.x] Add default initial option configuration option for Link fieldtype#14698
martyf wants to merge 1 commit into
statamic:6.xfrom
martyf:feature/link-fieldtype-default-type

Conversation

@martyf
Copy link
Copy Markdown
Contributor

@martyf martyf commented May 21, 2026

This adds a new default_option config option for the Link fieldtype. This allows a new field instance to have a configurable pre-set type - meaning for commonly used types, two less clicks.

The current behaviour is:

  • when required, url
  • when optional, null (appears as "None")

This behaviour is maintained when no default_option is set.

However, when a default_option is set, the default_option becomes the initial option for the fieldtype instead of the url or null above.

first-child and asset are special cases as they require specific conditions. If one of these is set as the default_option, it only is set as the initialOption in the fieldtype meta if it is actually available for the field.

Tests have been included for this new functionality.

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.

1 participant