-
Notifications
You must be signed in to change notification settings - Fork 74
DOC Prepare for docs site #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
GuySartorelli
merged 1 commit into
silverstripe:3.4
from
creative-commoners:pulls/3.4/docs-site
Jul 22, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| docs/en/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| --- | ||
| title: TagField Module Usage | ||
| summary: Managing tags on DataObjects, and integration with silverstripe-taxonomy | ||
| icon: tags | ||
| --- | ||
|
|
||
| # Usage | ||
|
|
||
| The primary use, for this module, is as a custom input field interface. For instance, imagine you had the following data objects: | ||
|
|
||
| ```php | ||
| namespace App\Models; | ||
|
|
||
| use SilverStripe\Blog\Model\BlogTag; | ||
| use SilverStripe\ORM\DataObject; | ||
|
|
||
| class BlogPost extends DataObject | ||
| { | ||
| private static $many_many = [ | ||
| 'BlogTags' => BlogTag::class, | ||
| ]; | ||
| } | ||
| ``` | ||
|
|
||
| ```php | ||
| namespace App\Models; | ||
|
|
||
| use SilverStripe\Blog\Model\BlogPost; | ||
| use SilverStripe\ORM\DataObject; | ||
|
|
||
| class BlogTag extends DataObject | ||
| { | ||
| private static $db = [ | ||
| 'Title' => 'Varchar(200)', | ||
| ]; | ||
|
|
||
| private static $belongs_many_many = [ | ||
| 'BlogPosts' => BlogPost::class, | ||
| ]; | ||
| } | ||
| ``` | ||
|
|
||
| If you wanted to link blog tags to blog posts, you might override [`DataObject::getCMSFields()`](api:SilverStripe\ORM\DataObject::getCMSFields()) with the following field: | ||
|
|
||
| ```php | ||
| use SilverStripe\Blog\Model\BlogTag; | ||
| use SilverStripe\TagField\TagField; | ||
|
|
||
| $field = TagField::create( | ||
| 'BlogTags', | ||
| 'Blog Tags', | ||
| BlogTag::get(), | ||
| $this->BlogTags() | ||
| ) | ||
| // tags should be lazy loaded | ||
| ->setShouldLazyLoad(true) | ||
| // new tag DataObjects can be created | ||
| ->setCanCreate(true); | ||
| ``` | ||
|
|
||
| This will present a tag field, in which you can select existing blog tags or create new ones. They will be created/linked after the blog posts are saved. | ||
|
|
||
| ## StringTagField | ||
|
|
||
| You can also store string-based tags, with the following field type: | ||
|
|
||
| ```php | ||
| use SilverStripe\TagField\StringTagField; | ||
|
|
||
| $field = StringTagField::create( | ||
| 'Tags', | ||
| 'Tags', | ||
| ['one', 'two'], | ||
| explode(',', $this->Tags) | ||
| ) | ||
| ->setCanCreate(true) | ||
| ->setShouldLazyLoad(true); | ||
| ``` | ||
|
|
||
| This assumes you are storing tags in the following data object structure: | ||
|
|
||
| ```php | ||
| namespace App\Models; | ||
|
|
||
| use SilverStripe\ORM\DataObject; | ||
|
|
||
| class BlogPost extends DataObject | ||
| { | ||
| private static $db = [ | ||
| 'Tags' => 'Text', | ||
| ]; | ||
| } | ||
| ``` | ||
|
|
||
| In the above code example, the options available (whether lazy loaded or not) would be "one" and "two", and the | ||
| user would be able to create new options. Whichever tags are chosen would be stored in the BlogPost's `Tags` field | ||
| as a comma-delimited string. | ||
|
|
||
| ## Using tagfield with silverstripe-taxonomy | ||
|
|
||
| TagField assumes that objects have a `Title` field. For classes without a `Title` field | ||
| use [`TagField::setTitleField()`](api:SilverStripe\TagField\TagField::setTitleField()) to modify accordingly. | ||
|
|
||
| ```php | ||
| use SilverStripe\TagField\TagField; | ||
| use SilverStripe\Taxonomy\TaxonomyTerm; | ||
|
|
||
| $field = TagField::create( | ||
| 'Tags', | ||
| 'Blog Tags', | ||
| TaxonomyTerm::get() | ||
| ) | ||
| ->setTitleField('Name'); | ||
| ``` | ||
File renamed without changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| title: TagField | ||
| summary: Provides a custom form field for adding tags to content, supporting either related data objects or simple string-based tags | ||
| icon: tags | ||
| --- | ||
|
|
||
| # TagField | ||
|
|
||
| The TagField module provides a custom form field for adding tags to content. It supports creating tags as related data objects or as a simple comma-separated list of strings. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| composer require silverstripe/tagfield | ||
| ``` | ||
|
|
||
| ## GitHub repository | ||
|
|
||
| <https://github.com/silverstripe/silverstripe-tagfield> | ||
|
|
||
| [CHILDREN] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.