code: protected function build(IMetaModelDataDefinition $container)
      {
          if (null === ($inputScreen = $this->viewCombination->getScreen($container->getName()))) {
              return;
          }
          $metaModel          = $this->factory->getMetaModel($container->getName());
          $variantHandling    = $metaModel->hasVariants();
          $palettesDefinition = $this->getOrCreatePaletteDefinition($container);
  
          $properties = $container->getPropertiesDefinition();
  
          $palettesDefinition->addPalette($palette = new Palette());
          $palette
              ->setName('default')
              ->setCondition(new DefaultPaletteCondition());
  
          foreach ($inputScreen['legends'] as $legendName => $legendInfo) {
              $legend = new Legend($legendName);
              $legend->setInitialVisibility(!$legendInfo['hide']);
              $palette->addLegend($legend);
  
              $legendConditions = $this->buildCondition($legendInfo['condition'], $metaModel);
              foreach ($legendInfo['properties'] as $property) {
                  $legend->addProperty(
                      $this->createProperty(
                          $properties->getProperty($property['name']),
                          $property['name'],
                          $variantHandling,
                          $this->buildCondition($property['condition'], $metaModel),
                          $legendConditions
                      )
                  );
              }
          }
      }
docs: Parse and build the backend view definition for the old Contao2 backend view.
  
  @param IMetaModelDataDefinition $container The data container.
  
  @return void