protected function registerModelRenderers()
{
if (empty($GLOBALS['METAMODELS']['filters'])) {
return;
}
$serviceContainer = $this->getServiceContainer();
foreach ($GLOBALS['METAMODELS']['filters'] as $typeName => $information) {
if (isset($information['info_callback'])) {
$this->addListener(ModelToLabelEvent::NAME, function (ModelToLabelEvent $event, $eventName, EventDispatcherInterface $dispatcher) use($typeName, $information, $serviceContainer) {
if ($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel_filtersetting' || $event->getModel()->getProperty('type') !== $typeName) {
return;
}
if (is_string($information['info_callback'])) {
$list = explode('::', $information['info_callback'], 2);
$instance = new $list[0]($serviceContainer);
$instance->{$list}[1]($event, $eventName, $dispatcher);
} else {
call_user_func($information['info_callback'], $event, $eventName, $dispatcher);
}
});
}
}
}