-
Notifications
You must be signed in to change notification settings - Fork 12
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
translating treedropdownfield #24
Comments
You have a Example, assuming Languages EN and FR. There's a Page called
So if you're in EN, you want to get |
It's a sitetree link (linktopageID in the database) to a form in this case. I guess it should be treated like a normal database-field translation (fieldname_locale) in the database. This way, i can have a different link for every translated version of the page. But in the same project i also use a sitetreelink in a dataobject calltoactionbutton. So clicking that button redirects the user to a specific page. Hope i explained it a bit clearly :) |
Yeah, relations aren't supported by the module at the moment. Whenever I had a scenario like yours, I solved it like this: A) Only allow editing the relation in the master language. Example: // only add the dropdown-field when in the default-locale
if(Translatable::default_locale() == Translatable::get_current_locale()) {
$fields->addFieldToTab('Root.Main', TreeDropdownField::create('linktopage'));
} B) Write a special getter that returns the page in the current locale (if translated). public function LinkedPage(){
if($this->linktopageID){
$master = $this->linktopage()->Master();
$currLocale = Translatable::get_current_locale();
if($master->hasTranslation($currLocale)){
return $master->getTranslation($currLocale);
}
return $master;
}
return null;
} Then in your code and templates use I hope this is an acceptable workaround. I'll implement proper |
Gonna try this. Thanks for looking into it! |
@guyvanbael Have you been able to solve this issue? |
No, i ended up changing the field to a norma textfield, so the link can be entered there. |
@bummzack Any plans on implementer relations in the near future? :) |
@sanderha I'm afraid not. Pull requests are welcome though! |
faild for me, too. Musn't it be: |
@dacar If you just want the link… yes. But |
Similar situation here.
and in Template use
|
Used this module on a dataobject that has a linktopage (treedropdownfield with sitetree). When page is translated and link is adjusted to another page. The link in de default language is also pointing to the new link (which is a translated page).
Is there a fix or workaround for this.
I presume that only extra columns are created for textfields?
The text was updated successfully, but these errors were encountered: