Get Mapped Page by cID and Language / Locale
Permalink 1 user found helpful
Hi,
I needed to hard code some links in my template, but was running into an issue where changing the url paths in alternate languages would cause the links to fail.
My current solution is to create a config variable with an array of the cIDs of each page I want to link to in each language and then when I need to make a link, I execute the following:
It works, but it seems cumbersome. Ideally, I would like there to be a function to find the page in an alternate language based on the given cID and the given locale or language string. i.e.
Any chance of this in a future version?
I needed to hard code some links in my template, but was running into an issue where changing the url paths in alternate languages would cause the links to fail.
My current solution is to create a config variable with an array of the cIDs of each page I want to link to in each language and then when I need to make a link, I execute the following:
<?php echo URL::to(Page::getCollectionPathFromID(Config::get('concrete.rockys.special_offers_page.'.Localization::activeLanguage()))); ?>
It works, but it seems cumbersome. Ideally, I would like there to be a function to find the page in an alternate language based on the given cID and the given locale or language string. i.e.
Page::getCollectionMultilingualPathFromID($cID, $local);
Any chance of this in a future version?
You already can retrieve the page in language Y associated to a page in language X.
What you could to is something like this: