-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
Localize Entities in Antlers by default? - Multi-Site #2991
Comments
I solved this with a custom Tag now: use Statamic\Facades\Site;
use Statamic\Tags\Tags;
class Load extends Tags
{
public function wildcard($tag)
{
$item = $this->context->value($tag);
// Return the relation in the current locale
return $item->in(Site::current()->handle());
}
} In an antlers template this looks like this: {{ load:parent }}
<p>Parent: <a href="{{ url }}">{{ title }}</a></p>
{{ /load:parent }} I think this is nice for multisites... May i create a PR for this either as the default behaviour or as an additional tag? |
It sounds like you're just asking the |
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me. |
Fetch the parent data from the current site/locale. Fixes statamic#2991
This is happening because your relationship field is called If you rename it to |
What i have:
en
andde
.Parent
andChild
The problem:
If i do the following in the template for a single parent it always shows me the default (en) version of the content, as that is what the parent ID links to.
But if i e.g. do the following, all the entries resolve to the ones in the current locale/site.
I can't find a reasonable solution to this and would suggest to always resolve entity fields to the version in the current locale (if that exists), like the
collection
tag does...The text was updated successfully, but these errors were encountered: