code: private function drawLegend(ModelToLabelEvent $event)
      {
          $model     = $event->getModel();
          $metaModel = $this->getMetaModelFromModel($model);
          if (is_array($legend = StringUtil::deserialize($model->getProperty('legendtitle')))) {
              foreach ([$metaModel->getActiveLanguage(), $metaModel->getFallbackLanguage()] as $language) {
                  if (array_key_exists($language, $legend) && !empty($legend[$language])) {
                      $legend = $legend[$language];
                      break;
                  }
              }
          }
          if (empty($legend)) {
              $legend = 'legend';
          }
  
          $event
              ->setLabel('<div class="field_heading cte_type %s"><strong>%s</strong></div>
                  <div class="dca_palette">%s%s</div>')
              ->setArgs([
                  $model->getProperty('published') ? 'published' : 'unpublished',
                  $this->trans('dcatypes.legend'),
                  $legend,
                  $model->getProperty('legendhide') ? ':hide' : ''
              ]);
      }
docs: Draw a legend.
  
  @param ModelToLabelEvent $event The event.
  
  @return void