Skip to content

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

Merged
jasonvarga merged 5 commits into
statamic:6.xfrom
martyf:feature/link-fieldtype-default-type
Jun 9, 2026
Merged

[6.x] Add default initial option configuration option for Link fieldtype#14698
jasonvarga merged 5 commits into
statamic:6.xfrom
martyf:feature/link-fieldtype-default-type

Conversation

@martyf

@martyf martyf commented May 21, 2026

Copy link
Copy Markdown
Contributor

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.

@jasonvarga jasonvarga enabled auto-merge (squash) June 9, 2026 21:24
@jasonvarga jasonvarga merged commit a216c27 into statamic:6.x Jun 9, 2026
18 checks passed
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.

2 participants