This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
mkilian53123
Hi guys. I'm trying to create CMS Page by hand in php (from component method). (main goal is to create page from frontend) I can achieve this with:
$page = new Cms\Classes\Page($attributes);
$page->save();
But how can i create Page with translations (Using translation plugin). I think i just need to add viewBag component with translations values. But i don't know how to set page content. I have content key in $attributes but it doesn't work.
mjauvin
Ok, here is one method (there could be a better one):
$page->attributes['viewBag'] = [
'localeUrl' => [
'fr' => '/french-URL',
'de' => '/deutch-URL',
],
'localeTitle' => [
'fr' => 'French Title',
'de' => 'Deutch Title',
],
];
$page->save();
1-3 of 3