本文整理匯總了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);
}