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.
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();
Yes exactly. Thank you very much sir.
1-3 of 3