mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 11:05:32 +02:00
Add documentation + alias
This commit is contained in:
parent
a167e20426
commit
0181932591
48
README.md
48
README.md
@ -1,3 +1,47 @@
|
||||
# silverstripe-tag-field
|
||||
# TagField Module
|
||||
|
||||
Tag text field for SilverStripe.
|
||||
[![Build Status](https://secure.travis-ci.org/silverstripe-labs/silverstripe-tagfield.png?branch=master)](https://travis-ci.org/silverstripe-labs/silverstripe-tagfield)
|
||||
|
||||
## Maintainer Contact
|
||||
|
||||
* Christopher Pitt (Nickname: assertchris) <chris (at) silverstripe (dot) com>
|
||||
|
||||
## Requirements
|
||||
|
||||
* SilverStripe 3.1 or newer
|
||||
* Database: MySQL 5+, SQLite3, Postgres 8.3, SQL Server 2008
|
||||
|
||||
## Download/Information
|
||||
|
||||
* http://silverstripe.org/tag-field-module
|
||||
|
||||
## Usage
|
||||
|
||||
```php
|
||||
class BlogPost extends DataObject {
|
||||
static $many_many = array(
|
||||
'BlogTags' => 'BlogTag'
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
```php
|
||||
class BlogTag extends DataObject {
|
||||
static $db = array(
|
||||
'Title' => 'Varchar(200)',
|
||||
);
|
||||
|
||||
static $belongs_many_many = array(
|
||||
'BlogPosts' => 'BlogPost'
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
```php
|
||||
$all = BlogTags::get()->map();
|
||||
$linked = $post->BlogTags()->map();
|
||||
|
||||
$field = new TagField(
|
||||
'BlogTags', 'Blog Tags', $all, $linked
|
||||
);
|
||||
```
|
@ -20,5 +20,10 @@
|
||||
},
|
||||
"require": {
|
||||
"silverstripe/framework": "~3.1"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-develop": "2.0.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user