Go to file
Christopher Pitt 89767f93d3 Merge pull request #48 from mediabeastnz/added-isMultiple-option
Added option to disable multiple selections.
2015-10-09 11:37:31 +13:00
code Added option to disable multiple selections. 2015-10-09 11:10:33 +13:00
css Upgrading select2 code to the latest version. This fixes a rendering bug in safari where the hidden text box has a border displayed around it, making it not so hidden. 2015-09-03 20:22:01 +09:30
docs/en Made supported 2015-09-09 13:28:43 +12:00
js Upgrading select2 code to the latest version. This fixes a rendering bug in safari where the hidden text box has a border displayed around it, making it not so hidden. 2015-09-03 20:22:01 +09:30
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
.gitattributes Made supported 2015-09-09 13:28:43 +12:00
.gitignore Moved source code 2015-04-14 13:15:28 +12:00
.scrutinizer.yml Made supported 2015-09-09 13:28:43 +12:00
.travis.yml Fixed code coverage reporting 2015-09-14 09:17:53 +12:00
changelog.md Updated changelog 2015-09-10 12:54:41 +12:00
code-of-conduct.md Fixed code of conduct 2015-09-10 12:37:05 +12:00
composer.json Removed version alias 2015-05-25 09:03:49 +12:00
contributing.md Made supported 2015-09-09 13:28:43 +12:00
license.md Made supported 2015-09-09 13:28:43 +12:00
readme.md Made supported 2015-09-09 13:28:43 +12:00

Tag Field

Custom tag input field, for SilverStripe.

Build Status Code Quality Code Coverage Version License

Requirements

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

Installing

$ composer require silverstripe/tagfield

Using

Relational Tags

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

	private static $belongs_many_many = array(
		'BlogPosts' => 'BlogPost'
	);
}
$field = TagField::create(
	'BlogTags',
	'Blog Tags',
	BlogTag::get(),
	$this->BlogTags()
)
	->setShouldLazyLoad(true) // tags should be lazy loaded
	->setCanCreate(true);     // new tag DataObjects can be created

String Tags

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

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

You can find more in-depth documentation in docs/en.

Versioning

This library follows Semver. According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library.

All methods, with public visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep protected methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading.

Reporting Issues

Please create an issue for any bugs you've found, or features you're missing.