Use the Sitecore Content Tagging framework in your custom solution
The Sitecore Content Tagging feature provides a generic framework with a set of abstractions that allows you to create a custom implementation for any part of the tagging process. The default implementation enables Sitecore to tag Sitecore items based on the content of each item. The Tag commands on the ribbon in the Content Editor and the Experience Editor integrate the feature into the Sitecore user interface (UI).
To integrate the Sitecore Content Tagging framework into your custom solution, you can use the default Sitecore Content Tagging implementation, or you can build custom providers to implement a custom tagging flow.
To use the default content tagging implementation for Sitecore items in your custom solution:
-
Get the
ContentTaggingRunner
andMessageBusFactory
services as follows:RequestResponseshellvar ContentTaggingRunner = ServiceLocator.ServiceProvider.GetService<IContentTaggingRunner>(); var MessageBusFactory = ServiceLocator.ServiceProvider.GetService<IMessageBusFactory>();
-
Create a message bus. The UI can communicate with the process through the message bus. You must also implement a custom message handler.
RequestResponseshellvar messageBus = MessageBusFactory.Create(); var messageHandler = new CustomMessageHandler(); messageBus.Subscribe(messageHandler);
-
Pass the content item and message bus instance to the runner.
RequestResponseshellContentTaggingRunner.Run(item, messageBus);