Jake Vanderwerf
2026-01-28 8c6502de2f8ec2bd8382cd6945c327d7be400e14
inc/meta/MetaForm.php
@@ -202,6 +202,7 @@
      $validationAttrs = $this->buildValidationAttributes($field);
      $conditional = array_key_exists('condition', $field) ? $this->handleConditionalField($field) : '';
      $pattern = array_key_exists('pattern', $field) ? $field['pattern'] : '';
      $customData = '';
      if (array_key_exists('data', $field) && !empty($field['data'])) {
         foreach ($field['data'] as $key => $v) {
@@ -225,6 +226,7 @@
               value="<?= esc_attr($data['value']) ?>"
               <?= $inputAttrs ?>
               <?= $customData?>
               <?= $pattern?>
            >
            <span class="validation-icon success" hidden aria-hidden="true">
                    <?= jvbIcon('check-circle') ?>
@@ -789,7 +791,9 @@
   {
      foreach ($field['fields'] as $field_name => $config) {
         // Set the group context for proper field naming
         $config['group'] = $groupName;
         if (!array_key_exists('wrap', $field) || $field['wrap'] !== 'details') {
            $config['group'] = $groupName;
         }
         // Get the value for this specific field
         $field_value = $values[$field_name] ?? '';
@@ -843,7 +847,7 @@
      // Build accept attribute for input
      $acceptExtensions = $this->getMimeExtensions($acceptedTypes);
      $acceptAttr = implode(',', $acceptExtensions);
      $acceptAttr = implode(',', $acceptedTypes);
      // Determine field attributes
      $subtype = $config['subtype'] ?? 'image';
@@ -1138,15 +1142,12 @@
            <summary class="row btw"><?=jvbIcon('pencil-simple')?><span>Edit Info</span></summary>
            <?php
            $fields = array_key_exists('fields', $config) ? $config['fields'] : [];
            // Only add image_data if not already provided
            if (!array_key_exists('image_data', $fields)) {
               $fields['image_data'] = [
                  'type'   => 'group',
                  'wrap'   => 'details',
                  'label'  => 'Image Info',
                  'hint'   => 'These will be automatically generated if left blank.',
            $fields = [
               'image_data' => [
                  'type'   => 'group',
                  'wrap'   => 'details',
                  'label'  => 'Image Fields',
                  'fields' => [
                     'image-title'.$addID => [
                        'type'  => 'text',
@@ -1168,9 +1169,9 @@
                        'data'  => $dataID
                     ]
                  ]
               ];
            }
               ]
            ];
            $fields = array_key_exists('fields', $config) ? array_merge($fields, $config['fields']) : $fields;
            $meta = new MetaManager($id);
            foreach ($fields as $field => $config) {
               $meta->render('form', $field, $config);
@@ -1194,7 +1195,7 @@
               <?php jvbRenderProgressBar('',true) ?>
               <input type="checkbox" class="upload-select" name="select-item" id="select-item<?=$addID?>">
               <label for="select-item<?=$addID?>" aria-label="Select image">
                  <?= ($attachment) ? $attachment : '<img>
                  <?= ($attachment) ?: '<img>
                  <video></video>
                  <span></span>'; ?>
               </label>
@@ -1267,7 +1268,7 @@
               <?php jvbRenderProgressBar('',true) ?>
               <input type="checkbox" class="upload-select" name="select-item" id="select-item<?=$addID?>">
               <label for="select-item<?=$addID?>" aria-label="Select image">
                  <?= ($attachment) ? $attachment : '<img>
                  <?= ($attachment) ?: '<img>
                  <video></video>
                  <span></span>'; ?>
               </label>
@@ -1594,11 +1595,11 @@
      // Default types based on subtype
      $defaults = [
         'image' => ['image/jpeg', 'image/png', 'image/gif', 'image/webp'],
         'video' => ['video/mp4', 'video/webm', 'video/ogg'],
         'document' => ['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
         'any' => ['image/*', 'video/*', 'application/pdf']
         'image' => ['image/*'],
         'video' => ['video/*'],
         'document' => ['application/pdf', 'application/msword', 'application/vnd.ms-excel', 'text/plain', '.odt','application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
      ];
      $defaults['any'] = array_merge($defaults['image'], $defaults['video'], $defaults['document']);
      return $defaults[$config['subtype']] ?? $defaults['image'];
   }