mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 09:05:32 +00:00
examples using create and chaining
New silverstripe funcitonality of create and chaining to be highlighted in the example
This commit is contained in:
parent
3bb0715835
commit
b4bea2ac1b
12
README.md
12
README.md
@ -37,12 +37,10 @@ class BlogTag extends DataObject {
|
||||
```
|
||||
|
||||
```php
|
||||
$field = new TagField(
|
||||
'BlogTags', 'Blog Tags', BlogTag::get(), $post->BlogTags()
|
||||
);
|
||||
|
||||
$field->setShouldLazyLoad(true); // tags should be lazy loaded
|
||||
$field->setCanCreate(true); // new tag DataObjects can be created
|
||||
$field = TagField::create(
|
||||
'BlogTags', 'Blog Tags', BlogTag::get(), $post->BlogTags()
|
||||
)->setShouldLazyLoad(true) // tags should be lazy loaded
|
||||
->setCanCreate(true); // new tag DataObjects can be created
|
||||
```
|
||||
|
||||
### String Tags
|
||||
@ -56,7 +54,7 @@ class BlogPost extends DataObject {
|
||||
```
|
||||
|
||||
```php
|
||||
$field = new StringTagField(
|
||||
$field = StringTagField::create(
|
||||
'BlogTags', 'Blog Tags', array('one', 'two'), explode(',', $post->Tags)
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user