CmsContentManagerUtils from frontend plugin
Posted: Thu May 06, 2021 11:24 pm
I am working on a plugin (used in a content page, with limited access by a MAMS group) that is supposed to create a content page on the fly.
I cannot load the pagedefaults by following the examples from some admin pages. that does not seem to work from frontend tag. Could someone point me in the right direction? Thanks
Code: Select all
$contentops = cmsms()->GetContentOperations();
//this line does not work:
$pagedefaults = CmsContentManagerUtils::get_pagedefaults();
$content_obj = $contentops->CreateNewContent('content');
$content_obj->SetOwner(1);
$content_obj->SetLastModifiedBy(1);
$content_obj->SetActive($pagedefaults['active']);
$content_obj->SetSecure($pagedefaults['secure']);
//and so on
...
//then
$error = $content_obj->ValidateData();
if(!$error)
{
$content_obj->Save();
}