Go to file
dependabot[bot] 7a19b709f2
Bump async from 2.6.3 to 2.6.4
Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4.
- [Release notes](https://github.com/caolan/async/releases)
- [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md)
- [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4)

---
updated-dependencies:
- dependency-name: async
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-28 21:08:54 +00:00
_config Setup TagField to work within AssetAdmin (Fixes #107) 2019-07-25 12:13:44 +12:00
.github/workflows MNT Add update JS deps workflow 2022-03-22 12:10:24 +13:00
client MNT Remove js prefix from require statements 2021-11-02 21:56:45 +13:00
docs/en Added screenshot 2019-07-04 09:11:11 +12:00
src ENH PHP 8.1 compatibility 2022-04-13 13:50:19 +12:00
templates/SilverStripe/TagField Additional changes to convert tagfield to use react-select 2018-07-16 13:27:11 +12:00
tests ENH PHP 8.1 compatibility 2022-04-13 13:50:19 +12:00
_config.php FIX Update module for latest SS4, vendorise 2017-10-18 14:19:15 +13:00
.editorconfig NEW Converting tagfield to use react components 2018-07-11 17:47:38 +12:00
.eslintrc.js Additional changes to convert tagfield to use react-select 2018-07-16 13:27:11 +12:00
.gitattributes Added standard git attributes 2015-11-19 19:13:48 +13:00
.gitignore FIX Adding a debounce to fetching lazy loaded tags with tag field 2018-12-04 16:15:47 +13:00
.nvmrc MNT Update to Node 10 2021-01-27 11:47:38 +13:00
.scrutinizer.yml FIX Update module for latest SS4, vendorise 2017-10-18 14:19:15 +13:00
.ss-storybook.js FIX Ensure tagfield is compatible with both React and Entwine contexts 2019-07-25 12:13:50 +12:00
.travis.yml MNT Use shared travis config, use sminnee/phpunit 2020-11-10 15:37:53 +13:00
.upgrade.yml FIX SS4 compatibility updates, PSR-4 in tests, table_name in stubs 2017-06-22 17:15:17 +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 DEP Set PHP 7.4 as the minimum version 2022-02-10 17:39:53 +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
package.json DEP Update JS dependencies 2021-11-22 16:51:14 +13:00
phpcs.xml.dist MNT Use shared travis config, use sminnee/phpunit 2020-11-10 15:37:53 +13:00
phpunit.xml.dist API phpunit 9 support 2021-10-27 18:15:33 +13:00
readme.md Update build status badge 2021-01-21 16:42:50 +13:00
webpack.config.js NEW Converting tagfield to use react components 2018-07-11 17:47:38 +12:00
yarn.lock Bump async from 2.6.3 to 2.6.4 2022-04-28 21:08:54 +00:00

Tag Field

Custom tag input field, for SilverStripe.

Build Status Code Quality Code coverage Version License SilverStripe supported module

Overview

Screenshot

Allows storing tags as a relationship, or comma-delimited strings. Supports autocompletion with lazy-loading.

Note: The field is optimised for usage in the SilverStripe CMS UI. The form field class itself can be used outside of the CMS, but you'll need to build your own frontend to interpret the raw field data (data-schema attribute).

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

Note: This assumes you have imported the namespaces class, e.g. use SilverStripe\TagField\TagField;

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.