silverstripe-tagfield/README.md

905 B

TagField Module

Build Status

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

Usage

class BlogPost extends DataObject {
	static $many_many = array(
		'BlogTags' => 'BlogTag'
	);
}
class BlogTag extends DataObject {
	static $db = array(
		'Title' => 'Varchar(200)',
	);

	static $belongs_many_many = array(
		'BlogPosts' => 'BlogPost'
	);
}
$all    = BlogTags::get()->map();
$linked = $post->BlogTags()->map();

$field = new TagField(
	'BlogTags', 'Blog Tags', $all, $linked
);