本文整理汇总了PHP中Cms\Classes\Page::withComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::withComponent方法的具体用法?PHP Page::withComponent怎么用?PHP Page::withComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cms\Classes\Page
的用法示例。
在下文中一共展示了Page::withComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWithComponentCallback
public function testWithComponentCallback()
{
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/Archive.php';
$pages = Page::withComponent('testArchive', function ($component) {
return $component->property('posts-per-page') == '69';
})->all();
$this->assertCount(1, $pages);
}
示例2: listPagesWithCampaignComponent
/**
* Returns a collection of page objects that use the
* Campaign Component provided by this plugin.
* @return array
*/
public function listPagesWithCampaignComponent()
{
$result = [];
$pages = Page::withComponent('campaignTemplate')->sortBy('baseFileName')->all();
foreach ($pages as $page) {
$baseName = $page->getBaseFileName();
$result[$baseName] = $page;
}
return $result;
}
示例3: getTemplatePageOptions
public function getTemplatePageOptions()
{
return Page::withComponent('campaignTemplate')->sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
}