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

Link label & target customization #15983

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented Oct 30, 2024

Description

Adds new “Show the ‘Label’ field” and “Show the ‘Open in a new tab’ field” settings to Link fields.

The new Link field settings

If either setting is enabled, the link field + label/target settings will be displayed with a light border surrounding them:

A Link field with both new settings activated

craft\fields\data\LinkData::getLink() will include the custom label and target="_blank" in its returned <a> tag when appropriate.

LinkData::getLabel() will return the custom label by default, if set. You can also now pass true to force the custom label to be returned or null if not; or false to force the default (link type-provided) label to be returned, ignoring the custom one.

The link target (null or '_blank') can be accessed via LinkData::$target.

Related issues

Copy link

linear bot commented Oct 30, 2024

[ci skip]
@brandonkelly brandonkelly merged commit 713ba7a into 5.5 Oct 30, 2024
@brandonkelly brandonkelly deleted the feature/cms-1345-link-label-target-customization branch October 30, 2024 20:45
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