Heyday\AdaptiveContent\SilverStripe\Traits\ClassBySecondaryIdentifierTrait
Allow setting the class of a DataObject using AdaptiveContent's SecondaryIdentifier field
The config key secondaryIdentifierClassMap is used to map classes to templates.
If a template doesn't have a mapping defined, the name of the class using this trait will be used.
Use in config:
secondaryIdentifierClassMap:
MyTemplate: MyTemplateClass
Synopsis
trait ClassBySecondaryIdentifierTrait
{
- // methods
- public void onBeforeWrite()
- public void getTemplateClass()
- protected void setClassNameBySecondaryIdentifier()
Methods
protected
- setClassNameBySecondaryIdentifier() — Change class name based on the mapping in config key secondaryIdentifierClassMap