public function actionSave(ParameterBag $params)
{
if (!$clonedId = $this->filter('cloned_id', 'int'))
{
return parent::actionSave($params);
}
$node = $this->em()->create('XF:Node');
$node->node_type_id = $this->getNodeTypeId();
$this->nodeSaveProcess($node)->run();
if ($this->filter('clone_mods', 'bool'))
{
$moderators = \XF::finder('XF:ModeratorContent')
->where('content_type', 'node')
->where('content_id', $clonedId)
->fetch();
foreach ($moderators AS $moderator)
{
$contentMod = $this->em()->create('XF:ModeratorContent');
$contentMod->content_type = $moderator->content_type;
$contentMod->content_id = $node->node_id;
$contentMod->user_id = $moderator->user_id;
$contentMod->save();
$contentPerms = \XF::finder('XF:PermissionEntryContent')
->where('content_type', 'node')
->where('content_id', $clonedId)
->where('user_id', $moderator->user_id)
->fetch()
->toArray();
$inserter = $this->service('EAEAddons\AdminTools:InsertPermissions');
$inserter->setUserId($moderator->user_id);
$inserter->setContentType('node');
$inserter->setContentId($node->node_id);
$inserter->insertPerms($contentPerms);
}
}
if ($this->filter('clone_perms', 'bool'))
{
// working on this part today
}
return $this->redirect($this->buildLink('nodes') . $this->buildLinkHash($node->node_id));
}