dia-nz/silverstripe-nestedcheckboxsetfield
Composer 安装命令:
composer require dia-nz/silverstripe-nestedcheckboxsetfield
包简介
Adds a level of nesting to a CheckboxSetField using a has_many/has_one relationship
关键字:
README 文档
README
This adds an extra level to a CheckboxSetField, which provides some structure to a large dataset.
Example Usage
The below will produce a set of nested fields where each Tag (which is selectable) sits under a Tag Category (just a heading, not selectable).
class Page extends SiteTree { static $many_many = array( 'PageTags' => 'Tag' );
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->insertBefore(
NestedCheckboxSetField::create('PageTags', 'Page Tags')
->setRootClass('TagCategory')
->setRootTitle('Title')
->setChildRelation('Tags')
->setChildTitle('Title'),
'Content'
);
}
}
class Tag extends DataObject { static $db = array( 'Title' => 'Varchar(100)' );
static $has_one = array(
'Category' => 'TagCategory'
);
}
class TagCategory extends DataObject { static $db = array( 'Title' => 'Varchar(100)' );
static $has_many = array(
'Tags' => 'Tag'
);
}
统计信息
- 总下载量: 109
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: WTFPL
- 更新时间: 2019-09-04