本文整理汇总了PHP中Concrete\Core\Page\Page::duplicate方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::duplicate方法的具体用法?PHP Page::duplicate怎么用?PHP Page::duplicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Page\Page
的用法示例。
在下文中一共展示了Page::duplicate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: duplicate
/**
* @param |\Concrete\Core\Page\Collection $nc
* @param bool $preserveUserID
* @param \Concrete\Core\Entity\Site\Site $site
*
* @return Stack
*/
public function duplicate($nc = null, $preserveUserID = false, TreeInterface $site = null)
{
if (!is_object($nc)) {
$nc = Page::getByID($this->getCollectionParentID());
}
$newPage = parent::duplicate($nc, $preserveUserID, $site);
// we have to do this because we need the area to exist before we try and add something to it.
Area::getOrCreate($newPage, STACKS_AREA_NAME);
$siteTreeID = is_object($site) ? $site->getSiteTreeID() : \Core::make('site')->getSite()->getSiteTreeID();
$db = Database::connection();
$db->executeQuery('insert into Stacks (stName, cID, stType, stMultilingualSection, siteTreeID) values (?, ?, ?, ?, ?)', [$newPage->getCollectionName(), $newPage->getCollectionID(), $this->getStackType(), $this->getMultilingualSectionID(), $siteTreeID]);
$newStack = static::getByID($newPage->getCollectionID());
if ($this->isNeutralStack()) {
foreach (Section::getList() as $section) {
$localized = $this->getLocalizedStack($section);
if ($localized !== null) {
$localized->duplicate($newStack, $preserveUserID);
}
}
}
return $newStack;
}
示例2: duplicate
public function duplicate($nc, $preserveUserID = false)
{
return parent::duplicate($nc, $preserveUserID);
}