Christopher Pitt abbbb591c3 Merge pull request #36 from 3Dgoo/feature/string-tag-field-fix
Fixing missing template error
2015-08-21 13:15:03 +12:00
2015-08-21 10:40:22 +09:30
2015-04-24 04:33:07 +12:00
2015-04-14 13:15:28 +12:00
2015-05-22 15:22:13 +12:00
2015-04-14 13:15:28 +12:00
2015-04-14 13:15:28 +12:00
2015-05-25 09:03:49 +12:00
2015-05-25 08:50:29 +12:00
2015-08-21 10:31:55 +09:30

TagField Module

Build Status Code Quality

Requirements

  • SilverStripe 3.1 or newer
  • Database: MySQL 5+, SQLite3, Postgres 8.3, SQL Server 2008

Download/Information

Usage

Relational Tags

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'
	);
}
$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

class BlogPost extends DataObject {
	static $db = array(
		'Tags' => 'Text'
	);
}
$field = StringTagField::create(
	'Tags', 'Tags', array('one', 'two'), explode(',', $this->Tags)
);

$field->setShouldLazyLoad(true); // tags should be lazy loaded
Description
No description provided
Readme 3.1 MiB
Languages
PHP 80.4%
JavaScript 19.3%
SCSS 0.3%