What happened?
Description
When adding a new site to an existing section, entries are correctly cloned from the primary site - that's expected and works well.
However, if the original entries from the primary site contain a Link field with the Entry type selected, the resulting link in the new site's cloned entry still points to the original entry URL on the primary site.
I guess this happens because the link field stores the site ID as part of its value, in a format like {entry:1321@1:url}, where 1 refers to the ID of the primary site.
When entries are duplicated for the new site, this internal reference remains unchanged, leading to incorrect URLs.
Steps to reproduce
- Create two websites with different languages and base URLs:
- NL:
localhost/nl (set as the primary site)
- FR:
localhost/fr
- Create a section called
Pages and assign both websites to it.
- Create a Link field, make it translatable, and assign it to the
Pages section.
- Add entries in the
Pages section: e.g., Home and Contact.
- In the
Home entry, set the Link field to type Entry, and select the Contact entry.
- On the entry detail template, display the link field value.
- Confirm that the link on the NL and FR
Home entries correctly points to the local Contact page.
- Now, create a new website:
- Assign the EN site to the
Pages section.
- New entries are created for the EN site, but the link in the
Home entry still points to the NL Contact page (localhost/nl/contact).
Expected behavior
When assigning the new EN site to the Pages section, the Link field in the Home entry should point to the EN version of the Contact page:
Actual behavior
The Link field in the Home entry for the EN site still points to the NL version of the Contact page:
Craft CMS version
5.5.3
PHP version
8.2.22
What happened?
Description
When adding a new site to an existing section, entries are correctly cloned from the primary site - that's expected and works well.
However, if the original entries from the primary site contain a Link field with the
Entrytype selected, the resulting link in the new site's cloned entry still points to the original entry URL on the primary site.I guess this happens because the link field stores the site ID as part of its value, in a format like
{entry:1321@1:url}, where 1 refers to the ID of the primary site.When entries are duplicated for the new site, this internal reference remains unchanged, leading to incorrect URLs.
Steps to reproduce
localhost/nl(set as the primary site)localhost/frPagesand assign both websites to it.Pagessection.Pagessection: e.g.,HomeandContact.Homeentry, set the Link field to typeEntry, and select theContactentry.Homeentries correctly points to the localContactpage.localhost/enPagessection.Homeentry still points to the NLContactpage (localhost/nl/contact).Expected behavior
When assigning the new EN site to the
Pagessection, the Link field in theHomeentry should point to the EN version of theContactpage:Actual behavior
The Link field in the
Homeentry for the EN site still points to the NL version of theContactpage:Craft CMS version
5.5.3
PHP version
8.2.22