This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
romo19554264
Hi, Can you help me to add Component to page, but in the code (dynamic). Here is example:
Set attributes: $attributes['title'] = "Home"; $attributes['url'] = "\";
Create page: $CreatePage = new Page($attributes); $CreatePage->save();
This work perfectly, but now i need to add Compoment for example: $CreatePage->addComponent("Menu");
Thanks for your response.
mjauvin
Based on this trick:
(https://octobertricks.com/tricks/create-cms-page-with-translation-from-php-code)
Try replacing the line assigning a viewBag with this one:
$page->attributes['Menu'] = [];
1-3 of 3