Go to file
Guy Marriott e739275305
Merge pull request #138 from creative-commoners/pulls/1.0/scalars
FIX StringTagField now works with SS-2018-021/CVE-2019-5715 by serialising arrays before write
2019-02-19 17:29:18 +13:00
code FIX StringTagField now works with SS-2018-021/CVE-2019-5715 by serialising arrays before write 2019-02-19 11:09:31 +07:00
css Correct close button image 2015-04-24 04:33:07 +12:00
js Stabilized API 2015-05-22 15:22:13 +12:00
templates Moved source code 2015-04-14 13:15:28 +12:00
tests Stabilized API 2015-05-22 15:22:13 +12:00
_config.php Moved source code 2015-04-14 13:15:28 +12:00
.gitignore Moved source code 2015-04-14 13:15:28 +12:00
.travis.yml Added tests and extra ajax functionality 2015-04-27 10:38:46 +12:00
composer.json Add documentation + alias 2015-04-28 11:55:33 +12:00
README.md Stabilized API 2015-05-22 15:22:13 +12:00

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 = new TagField(
	'BlogTags', 'Blog Tags', BlogTags::get(), $post->BlogTags()
);

$field->setShouldLazyLoad(true); // tags should be lazy loaded
$field->setCanCreate(true);      // new tag DataObjects can be created

String Tags

class BlogPost extends DataObject {
	static $db = array(
		'Tags' => 'Text'
	);
}
$field = new StringTagField(
	'BlogTags', 'Blog Tags', array('one', 'two'), explode(',', $post->Tags)
);

$field->setShouldLazyLoad(true); // tags should be lazy loaded