Go to file
Nivanka Fonseka 7691fc27c6 Tag field to look similar to list field (#108)
* updated the CSS of the tag field to match with 

the dropdown fields / list fields

* resolve with of the field to the style attr of 

dropdown

* added style width

* removed the empty lines

* changed to the correct classname readonly tag field

* fixed the tag field signature

* removed the whitespace ending in line 352
2018-02-20 13:39:58 +00:00
css Tag field to look similar to list field (#108) 2018-02-20 13:39:58 +00:00
docs/en SilverStripe 4 compatibility (#87) 2017-01-13 19:11:59 +00:00
js Tag field to look similar to list field (#108) 2018-02-20 13:39:58 +00:00
src Tag field to look similar to list field (#108) 2018-02-20 13:39:58 +00:00
templates/SilverStripe/TagField SilverStripe 4 compatibility (#87) 2017-01-13 19:11:59 +00:00
tests tiny updates for coding standards 2018-01-24 12:16:15 +05:30
.editorconfig Added standard editor config 2015-11-19 13:26:56 +13:00
.gitattributes Added standard git attributes 2015-11-19 19:13:48 +13:00
.gitignore Moved source code 2015-04-14 13:15:28 +12:00
.scrutinizer.yml FIX Update module for latest SS4, vendorise 2017-10-18 14:19:15 +13:00
.travis.yml FIX Update module for latest SS4, vendorise 2017-10-18 14:19:15 +13:00
.upgrade.yml FIX SS4 compatibility updates, PSR-4 in tests, table_name in stubs 2017-06-22 17:15:17 +12:00
_config.php FIX Update module for latest SS4, vendorise 2017-10-18 14:19:15 +13:00
changelog.md Update changelog for 1.3.0 2016-05-19 11:53:13 +12:00
code-of-conduct.md Added standard code of conduct 2015-11-21 20:17:21 +13:00
codecov.yml FIX Update module for latest SS4, vendorise 2017-10-18 14:19:15 +13:00
composer.json FIX Update module for latest SS4, vendorise 2017-10-18 14:19:15 +13:00
contributing.md Made supported 2015-09-09 13:28:43 +12:00
license.md Updated license year 2016-01-01 06:38:06 +13:00
phpunit.xml.dist FIX Update module for latest SS4, vendorise 2017-10-18 14:19:15 +13:00
readme.md FIX Update module for latest SS4, vendorise 2017-10-18 14:19:15 +13:00

readme.md

Tag Field

Custom tag input field, for SilverStripe.

Build Status Code Quality Code coverage Version License

Requirements

  • SilverStripe 4.0

Installing

$ composer require silverstripe/tagfield

Using

Relational Tags

use SilverStripe\ORM\DataObject;

class BlogPost extends DataObject
{
	private static $many_many = [
		'BlogTags' => BlogTag::class
	];
}
use SilverStripe\ORM\DataObject;

class BlogTag extends DataObject
{
	private static $db = [
		'Title' => 'Varchar(200)',
	];

	private static $belongs_many_many = [
		'BlogPosts' => BlogPost::class
	];
}
$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

use SilverStripe\ORM\DataObject;

class BlogPost extends DataObject
{
	private static $db = [
		'Tags' => 'Text',
	];
}
$field = StringTagField::create(
	'Tags',
	'Tags',
    ['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.