Jake Vanderwerf
13 hours ago f16cb88a3218ac7bb32e43f0e0a2542d35c7a01b
inc/meta/Form.php
@@ -57,8 +57,15 @@
   {
      $id = $options['form-id'] ?? $endpoint;
      $classes = isset($options['classes']) ? ' class="' . implode(' ', $options['classes']) . '"' : '';
      $formID = isset($options['showFormID']) && $options['showFormID']!== false;
      $output = '<form id="' . esc_attr($endpoint) . '"' . $classes . ' data-save="' . esc_attr($endpoint) . '" data-form-id="' . esc_attr($id) . '">';
      $output = sprintf(
         '<form id="%s"%s data-save="%s"%s>',
         esc_attr($endpoint),
         $classes,
         esc_attr($endpoint),
         $formID ? ' data-form-id="'.esc_attr($id).'"' : '',
      );
      if (!empty($options['heading'])) {
         $output .= '<h2>' . esc_html($options['heading']) . '</h2>';
@@ -70,7 +77,9 @@
            $output .= '<p>' . esc_html($d) . '</p>';
         }
      }
      error_log('[Form]::renderFormFrom getting fields: '.print_r($fields, true));
      $allFields = $meta->getAll($fields);
      error_log('[Form]::renderFormFrom field values: '.print_r($allFields, true));
      foreach ($allFields as $name => $value) {
         $config = $meta->config($name);
         $output .= static::render($name, $value, $config);
@@ -557,17 +566,17 @@
         $checked = in_array($optValue, $values) ? ' checked' : '';
         $checkboxes .= sprintf(
            '
                    <input type="checkbox" name="%s[]" id="%s-%s" value="%s"%s />
                    <input type="checkbox" name="%s" id="%s-%s" value="%s"%s/>
            <label class="checkbox-option" for="%s-%s">
                    <span>%s</span>
                </label>',
            esc_attr($name),
            esc_attr($name),
            $optValue,
            esc_attr($optValue),
            esc_attr($optValue),
            $checked,
            esc_attr($name),
            $optValue,
            esc_attr($optValue),
            esc_html($optLabel)
         );
      }
@@ -1706,7 +1715,7 @@
      foreach ($fields as $fieldName => $fieldConfig) {
         $fieldValue = $values[$fieldName] ?? '';
         $fullName = array_key_exists('wrap', $config) ? $fieldName : "{$name}:{$fieldName}";
         $fullName = "{$name}|{$fieldName}";
         $output .= static::render($fullName, $fieldValue, $fieldConfig);
      }