code: private function prepareFieldOptions(CustomField $customField, $type)
      {
          $options = $customField->getOptions();
          
          /**
           * @var mixed[] the formField options
           */
          $fieldOptions = array();
          
          // add required 
          $fieldOptions['required'] = False;
          
          //add label
          $fieldOptions['label'] = $this->translatableStringHelper->localize($customField->getName());
          
          // add constraints if required
          if ($options[self::MIN] !== NULL) {
              $fieldOptions['constraints'][] = new GreaterThanOrEqual(array('value' => $options[self::MIN]));
          }
          if ($options[self::MAX] !== NULL) {
              $fieldOptions['constraints'][] = new LessThanOrEqual(array('value' => $options[self::MAX]));
          }
          
          // add precision to options if required
          if ($type === 'number') {
              $fieldOptions['scale'] = $options[self::SCALE];
          }
          
          if (!empty($options[self::POST_TEXT])) {
              $fieldOptions['post_text'] = $options[self::POST_TEXT];
          }
          
          return $fieldOptions;
      }
docs: prepare the options'form field
  
  @param CustomField $customField
  @param string $type
  @return mixed[]