MetadataTemplateRegistry
in package
Registry for metadata template providers.
Plugins register their metadata template support here instead of being hardcoded in QubitMetadataRoute::$METADATA_PLUGINS.
Usage: // In plugin configuration initialize(): MetadataTemplateRegistry::register($this);
// To get plugin for a template: $plugin = MetadataTemplateRegistry::getPluginForTemplate('museum');
Table of Contents
Methods
- clear() : void
- Clear all registered providers (useful for testing).
- getModuleForTemplate() : string|null
- Get module name for a template.
- getPluginForTemplate() : string|null
- Get plugin name for a template.
- getTemplateCodes() : array<string|int, string>
- Get all available template codes.
- getTemplatePluginMap() : array<string, string>
- Get all templates mapped to their plugins.
- hasTemplate() : bool
- Check if a template is available.
- register() : void
- Register a metadata template provider.
Methods
clear()
Clear all registered providers (useful for testing).
public
static clear() : void
getModuleForTemplate()
Get module name for a template.
public
static getModuleForTemplate(string $code) : string|null
Parameters
- $code : string
Return values
string|nullgetPluginForTemplate()
Get plugin name for a template.
public
static getPluginForTemplate(string $code) : string|null
Parameters
- $code : string
Return values
string|nullgetTemplateCodes()
Get all available template codes.
public
static getTemplateCodes() : array<string|int, string>
Return values
array<string|int, string>getTemplatePluginMap()
Get all templates mapped to their plugins.
public
static getTemplatePluginMap() : array<string, string>
This provides the same format as the old QubitMetadataRoute::$METADATA_PLUGINS.
Return values
array<string, string>hasTemplate()
Check if a template is available.
public
static hasTemplate(string $code) : bool
Parameters
- $code : string
Return values
boolregister()
Register a metadata template provider.
public
static register(MetadataTemplateProviderInterface $provider) : void
Parameters
- $provider : MetadataTemplateProviderInterface