pr3set-llc/silverstripe-collection
最新稳定版本:5.0.0
Composer 安装命令:
composer require pr3set-llc/silverstripe-collection
包简介
Display a filterable collection of pages or dataobjects on a page.
关键字:
README 文档
README
Display a filterable collection of pages or dataobjects on a page.
Requirements
- SilverStripe 4.x
Installation
composer require dynamic/silverstripe-collection
Configuration
In your config.yml:
Your/Namespace/ExamplePageController:
managed_object: ExampleObject
page_size: 10
extensions:
- Dynamic\Collection\CollectionExtension
Managed Page/DataObject
Collection will create a search form based on the managed object's $searchable_fields.
private static $searchable_fields = [
'Title' => [
'title' => 'Name',
],
'Category.ID' => [
'title' => 'Category',
],
];
For advanced setups, you can also create getCustomSearchContext() on your managed object.
To include a sorting dropdown field, create a getSortOptions() method on your managed object:
public function getSortOptions()
{
return array(
'Created' => 'Date',
'Title' => 'Name A-Z',
'Title DESC' => 'Name Z-A',
);
}
Templates
$CollectionSearchForm will display the search form.
You have mutliple options to loop through the results in your template:
$Collectionwill display a list of all results$PaginatedListwill paginate the results$GroupedList.GroupedBy(CategoryTitle)will display results grouped by the variable you pass
Documentation
See the docs/en folder.
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2025-10-09