Currently link fields use the default TextFieldItemProcessor, which does not format links according to display settings.

Add a new processor for Link fields which does.

Patch to follow.

Comments

Leo Pitt created an issue. See original summary.

leo pitt’s picture

Status: Active » Needs review
StatusFileSize
new1.83 KB
leo pitt’s picture

StatusFileSize
new1.84 KB
mostepaniukvm’s picture

Thanks for contribution. On d9.5 CI green and internal CI doesn't report any regression.
I tested patch locally.
Before it was like this:

<template #link>
  <field-link title="link title">entity:node/123</field-link>
</template>

With new processors it is rendered like this:

<template #link>
  <a href="/path-alias/of-node">link title</a>
</template>

Now it respects formatter settings from given view mode.

But I am a little in doubt if it's fine to have just rendered <a> tag instead of <field-link> custom element. @fago, Could you confirm, please?
If it's fine then RTBC and can be committed in 2.x

fago’s picture

Status: Needs review » Needs work

I agree this is a better default, but technically changing the default is BC break, since people might be using the current field-link.

Generally, I think it's not ideal to use separate slot for simple field like that, but add the link-data as prop so the frontend can freely position and render the link. What would you think about that Leo?

Setting to needs work since we need to discuss the BC issue.

fago’s picture

Title: Add support for Link field items » Make link fields default to render as link via a slot
Version: 8.x-2.x-dev » 3.x-dev
Status: Needs work » Reviewed & tested by the community

we discussed in the meeting to move those improvements into 3.x, so we don't have an issue with BC breaks.

mostepaniukvm’s picture

Status: Reviewed & tested by the community » Fixed

Merged into 3.x branch. Also synced 3.x with the latest changes in 8.x-2x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.