code/extensions/TaggingExtension.php
public function updateCMSFields(FieldList $fields) {

		$fields->removeByName('FusionTags');

		// Determine whether consolidated tags are found in the existing relationships.

		$types = array();
		foreach(singleton('FusionService')->getFusionTagTypes() as $type => $field) {
			$types[$type] = $type;
		}
		$types = array_intersect($this->owner->many_many(), $types);
		if(empty($types)) {

			// There are no consolidated tags found, therefore instantiate a tagging field.

			$fields->addFieldToTab('Root.Tagging', ListboxField::create(
				'FusionTags',
				'Tags',
				FusionTag::get()->map()->toArray()
			)->setMultiple(true));
		}

		// Allow extension.

		$this->owner->extend('updateTaggingExtensionCMSFields', $fields);
	}
public function updateCMSFields(FieldList $fields) {

		$fields->removeByName('FusionTags');

		// Determine whether consolidated tags are found in the existing relationships.

		$types = array();
		foreach(singleton('FusionService')->getFusionTagTypes() as $type => $field) {
			$types[$type] = $type;
		}
		$types = array_intersect($this->owner->many_many(), $types);
		if(empty($types)) {

			// There are no consolidated tags found, therefore instantiate a tagging field.

			$fields->addFieldToTab('Root.Tagging', ListboxField::create(
				'FusionTags',
				'Tags',
				FusionTag::get()->map()->toArray()
			)->setMultiple(true));
		}

		// Allow extension.

		$this->owner->extend('updateTaggingExtensionCMSFields', $fields);
	}
public function updateCMSFields ( FieldList $ fields ) { $ fields -> removeByName ( 'FusionTags' ) ; // Determine whether consolidated tags are found in the existing relationships. $ types = array ( ) ; foreach ( singleton ( 'FusionService' ) -> getFusionTagTypes ( ) as $ type => $ field ) { $ types [ $ type ] = $ type ; } $ types = array_intersect ( $ this -> owner -> many_many ( ) , $ types ) ; if ( empty ( $ types ) ) { // There are no consolidated tags found, therefore instantiate a tagging field. $ fields -> addFieldToTab ( 'Root.Tagging' , ListboxField :: create ( 'FusionTags' , 'Tags' , FusionTag :: get ( ) -> map ( ) -> toArray ( ) ) -> setMultiple ( true ) ) ; } // Allow extension. $ this -> owner -> extend ( 'updateTaggingExtensionCMSFields' , $ fields ) ; }
Display the appropriate tagging field.
Display the appropriate tagging field .