本文整理汇总了PHP中CollectionType::getComposerPageTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CollectionType::getComposerPageTypes方法的具体用法?PHP CollectionType::getComposerPageTypes怎么用?PHP CollectionType::getComposerPageTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CollectionType
的用法示例。
在下文中一共展示了CollectionType::getComposerPageTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* Views the composer edit page.
* @param string|int $ctID The collection type
* @param string|int $cPublishParentID The parent page under which to publish
*/
public function view($ctID = false, $cPublishParentID = false)
{
// Load Page objects from their IDs
$ct = $this->setCollectionType($ctID);
$cPublishParent = Page::getByID($cPublishParent);
// If we couldn't load a collection type, send them to the composer menu
if (!is_object($ct)) {
$ctArray = CollectionType::getComposerPageTypes();
// If there's only one collection type, just choose that one
if (count($ctArray) === 1) {
$ct = $ctArray[0];
$this->redirect('/dashboard/composer/write', $ct->getCollectionTypeID());
exit;
}
// Otherwise, they need to choose the CT from this array of types
$this->set('ctArray', $ctArray);
} else {
// CT was set, so create a draft of this type
$entry = ComposerPage::createDraft($ct);
if (is_object($entry)) {
// Check if we have a parent specified to create this draft under
if ($cPublishParentID && is_object($cPublishParent)) {
// Make this draft under the specified parent
$entry->setComposerDraftPublishParentID($cPublishParentID);
}
// New draft is created, so start editing it
$this->redirect('/dashboard/composer/write', 'edit', $entry->getCollectionID());
} else {
// Something failed when trying to create a draft, so send back to drafts folder
$this->redirect('/dashboard/composer/drafts');
}
}
}
示例2: view
/**
* Display all page types controlled by the composer
*
* @return type
*/
public function view($redirect = true)
{
$cap = Loader::helper('concrete/dashboard');
if (!$cap->canAccessComposer()) {
return;
}
$composerCollectionTypes = CollectionType::getComposerPageTypes();
if (count($composerCollectionTypes) == 1 && $redirect) {
$ct = $composerCollectionTypes[0];
$this->redirect('/dashboard/composer/list/show', $ct->getCollectionTypeID());
exit;
}
$this->set('composerCollectionTypes', $composerCollectionTypes);
}
示例3: view
public function view($ctID = false) {
$ct = $this->setCollectionType($ctID);
if (!is_object($ct)) {
$ctArray = CollectionType::getComposerPageTypes();
if (count($ctArray) == 1) {
$ct = $ctArray[0];
$this->redirect('/dashboard/composer/write', $ct->getCollectionTypeID());
exit;
}
$this->set('ctArray', $ctArray);
//$this->redirect('/dashboard/composer');
} else {
// create a new page of this type
$entry = ComposerPage::createDraft($ct);
$this->redirect('/dashboard/composer/write', 'edit', $entry->getCollectionID());
}
}