Skip to content

dnadesign/silverstripe-tagurit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tag ur it!

An alternative taxonomy module for SilverStripe

Introduction

This module inverts the term/type relationship to type/term and allows setting default/protected types/terms

Requirements

  • SilverStripe 4.4
  • GridFieldExtensions 3.2

Installation

Include the following in your composer.json and run composer update:

"require": {
    dnadesign/silverstripe-tagurit
}
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/dnadesign/silverstripe-tagurit.git"
        }
    ],

Configure the yml:

tagurit_protected_taxonomy:
  Type one:
    - Term
    - Second Term
  Second type:
    - Another Term

On your page, use the trait

    use TaxonomyTrait;

     private static $many_many = [
        'CustomTerms' => TaxonomyTerm::class
    ];
    
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->addFieldsToTab(
            'Root.Terms',
            [
                ListboxField::create(
                    'CustomTerms',
                    'Custom Terms',
                    $this->getTermsForType('Second type')
                ),
            ]
        );

        return $fields;
    }

Run the build task:

vendor/silverstripe/framework/sake dev/build flush=1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages