silverstripe-dms/docs/en/manage-tags.md

553 B

Manage Tags

Find documents by tag

$dms = DMS::getDMSInstance();
$docs = $dms->getByTag('priority', 'important');

Add tag to existing document

$doc = DMSDocument::get()->byID(99);
$doc->addTag('priority', 'low');

Supports multiple values for tags

$doc->addTag('category', 'keyboard');
$doc->addTag('category', 'input device');

Removing tags

Removing tags is abstracted as well.

$doc->removeTag('category', 'keyboard');
$doc->removeTag('category', 'input device');
$doc->removeAllTags();