本文整理汇总了PHP中Cms\Classes\Page::inTheme方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::inTheme方法的具体用法?PHP Page::inTheme怎么用?PHP Page::inTheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cms\Classes\Page
的用法示例。
在下文中一共展示了Page::inTheme方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLists
public function testLists()
{
// Default theme: test
$pages = Page::lists('baseFileName');
sort($pages);
$this->assertEquals(["404", "a/a-page", "ajax-test", "authors", "b/b-page", "blog-archive", "blog-post", "code-namespaces", "component-custom-render", "component-partial", "component-partial-nesting", "component-partial-override", "cycle-test", "index", "no-component", "no-component-class", "no-layout", "no-partial", "optional-full-php-tags", "optional-short-php-tags", "throw-php", "with-component", "with-components", "with-content", "with-layout", "with-partials", "with-placeholder"], $pages);
$layouts = Layout::lists('baseFileName');
sort($layouts);
$this->assertEquals(["a/a-layout", "ajax-test", "content", "cycle-test", "no-php", "partials", "php-parser-test", "placeholder", "sidebar"], $layouts);
$pages = Page::inTheme('NON_EXISTENT_THEME')->lists('baseFileName');
$this->assertEmpty($pages);
}
示例2: initCmsPage
/**
* Creates a CMS page from a static page and configures it.
* @param string $url Specifies the static page URL.
* @return \Cms\Classes\Page Returns the CMS page object or NULL of the requested page was not found.
*/
public function initCmsPage($url)
{
$router = new Router($this->theme);
$page = $router->findByUrl($url);
if (!$page) {
return null;
}
$viewBag = $page->viewBag;
$cmsPage = CmsPage::inTheme($this->theme);
$cmsPage->url = $url;
$cmsPage->apiBag['staticPage'] = $page;
/*
* Transfer specific values from the content view bag to the page settings object.
*/
$viewBagToSettings = ['title', 'layout', 'meta_title', 'meta_description', 'is_hidden'];
foreach ($viewBagToSettings as $property) {
$cmsPage->settings[$property] = array_get($viewBag, $property);
}
return $cmsPage;
}
示例3: onGetTemplateList
public function onGetTemplateList()
{
$this->validateRequestTheme();
$page = Page::inTheme($this->theme);
return ['layouts' => $page->getLayoutOptions()];
}
示例4: testListsNonExistentTheme
public function testListsNonExistentTheme()
{
$pages = Page::inTheme('NON_EXISTENT_THEME')->lists('baseFileName');
$this->assertEmpty($pages);
}