code: public function render(ModelToLabelEvent $event)
      {
          $environment = $event->getEnvironment();
          /** @var IMetaModelDataDefinition $definition */
          $definition = $environment->getDataDefinition();
          /** @var Contao2BackendViewDefinitionInterface $viewSection */
          $viewSection = $definition->getDefinition(Contao2BackendViewDefinitionInterface::NAME);
          $listing     = $viewSection->getListingConfig();
  
          /** @var Model $model */
          $model = $event->getModel();
  
          if (!($model instanceof Model)) {
              return;
          }
  
          $nativeItem = $model->getItem();
          $metaModel  = $nativeItem->getMetaModel();
  
          $renderSetting = $this->renderSettingFactory
              ->createCollection($metaModel, $definition->getMetaModelDefinition()->getActiveRenderSetting());
  
          if (!$renderSetting) {
              return;
          }
  
          $data = array($nativeItem->parseValue('html5', $renderSetting));
  
          if ($listing->getShowColumns()) {
              $event->setArgs($data[0]['html5']);
              return;
          }
  
          $template      = new Template($renderSetting->get('template'));
          $renderSetting = self::removeInvariantAttributes($nativeItem, $renderSetting);
  
          $template->setData(
              array(
                  'settings' => $renderSetting,
                  'items'    => new Items(array($nativeItem)),
                  'view'     => $renderSetting,
                  'data'     => $data
              )
          );
  
          $event->setLabel('%s')->setArgs(array($template->parse('html5')));
      }
docs: Render the current item using the specified render setting.
  
  @param ModelToLabelEvent $event The event.
  
  @return void