Add documentation + alias

This commit is contained in:
Christopher Pitt 2015-04-28 11:55:33 +12:00
parent a167e20426
commit 0181932591
2 changed files with 51 additions and 2 deletions

View File

@ -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
);
```

View File

@ -20,5 +20,10 @@
},
"require": {
"silverstripe/framework": "~3.1"
},
"extra": {
"branch-alias": {
"dev-develop": "2.0.x-dev"
}
}
}