本文整理汇总了PHP中Concrete\Core\Page\Page::isPageDraft方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::isPageDraft方法的具体用法?PHP Page::isPageDraft怎么用?PHP Page::isPageDraft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Page\Page
的用法示例。
在下文中一共展示了Page::isPageDraft方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPublishButtonTitle
public function getPublishButtonTitle(Page $c)
{
if ($c->isPageDraft()) {
$publishTitle = t('Publish Page');
} else {
$publishTitle = t('Publish Changes');
}
$pk = Key::getByHandle('approve_page_versions');
$pk->setPermissionObject($c);
$pa = $pk->getPermissionAccessObject();
$workflows = array();
$canApproveWorkflow = true;
if (is_object($pa)) {
$workflows = $pa->getWorkflows();
}
foreach ($workflows as $wf) {
if (!$wf->canApproveWorkflow()) {
$canApproveWorkflow = false;
}
}
if (count($workflows) > 0 && !$canApproveWorkflow) {
$publishTitle = t('Submit to Workflow');
}
return $publishTitle;
}
示例2: publishToPage
public function publishToPage(Page $c, $data, $controls)
{
if (!is_array($data)) {
$data = [];
}
$data += ['name' => null];
$slug = array_filter($controls, function ($item) {
if ($item instanceof UrlSlugCorePageProperty) {
return true;
}
return false;
});
$this->addPageTypeComposerControlRequestValue('cName', $data['name']);
if (!count($slug) && $c->isPageDraft()) {
$txt = new Text();
$this->addPageTypeComposerControlRequestValue('cHandle', $txt->urlify($data['name'], \Config::get('concrete.seo.segment_max_length')));
}
parent::publishToPage($c, $data, $controls);
}
示例3: getBySectionOfSite
/**
* @param Page $page
*
* @return Section
*/
public static function getBySectionOfSite($page)
{
$identifier = sprintf('/multilingual/section/%s', $page->getCollectionID());
$cache = \Core::make('cache/request');
$item = $cache->getItem($identifier);
if (!$item->isMiss()) {
$returnID = $item->get();
} else {
$returnID = null;
$item->lock();
if ($page->getPageTypeHandle() == STACKS_PAGE_TYPE) {
$parent = Page::getByID($page->getCollectionParentID());
if ($parent->getCollectionPath() == STACKS_PAGE_PATH) {
// this is the default multilingual section.
return static::getDefaultSection();
} else {
// this is a stack category page type
$locale = $parent->getCollectionHandle();
return static::getByLocale($locale);
}
} else {
if ($page->isPageDraft() && $page->getPageDraftTargetParentPageID()) {
$cParentID = $page->getPageDraftTargetParentPageID();
} else {
$cParentID = $page->getCollectionParentID();
}
$parent = \Page::getByID($cParentID);
$nav = \Core::make('helper/navigation');
$pages = $nav->getTrailToCollection($parent);
$pages = array_reverse($pages);
$pages[] = $parent;
$pages[] = $page;
$ids = self::getIDList();
$returnID = false;
foreach ($pages as $pc) {
if (in_array($pc->getCollectionID(), $ids)) {
$returnID = $pc->getCollectionID();
}
}
}
$item->set($returnID);
}
if ($returnID) {
return static::getByID($returnID);
}
}
示例4: isPageDraft
public function isPageDraft()
{
return parent::isPageDraft();
}