code: private function createProperty(
          PropertyInterface $property,
          $propertyName,
          $variantHandling,
          ConditionInterface $condition = null,
          ConditionInterface $legendCondition = null
      ) {
          $paletteProperty = new Property($propertyName);
  
          $extra = $property->getExtra();
  
          $chain = new PropertyConditionChain();
          $paletteProperty->setEditableCondition($chain);
          if (isset($extra['readonly'])) {
              $chain->addCondition(new BooleanCondition($extra['readonly']));
          }
  
          $chain = new PropertyConditionChain();
          $paletteProperty->setVisibleCondition($chain);
          // If variants, do show only if allowed.
          if ($variantHandling) {
              $chain->addCondition(new IsVariantAttribute());
          }
          $chain->addCondition(
              new BooleanCondition(
                  !((isset($extra['doNotShow']) && $extra['doNotShow'])
                  || (isset($extra['hideInput']) && $extra['hideInput']))
              )
          );
  
          if (null !== $condition) {
              $chain->addCondition($condition);
          }
          if (null !== $legendCondition) {
              $chain->addCondition($legendCondition);
          }
  
          return $paletteProperty;
      }
docs: Create a property for the palette.
  
  @param PropertyInterface       $property        The input screen.
  @param string                  $propertyName    The property name.
  @param bool                    $variantHandling The MetaModel instance.
  @param ConditionInterface|null $condition       The condition.
  @param ConditionInterface|null $legendCondition The condition.
  
  @return Property