| | |
| | | $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) { |
| | |
| | | value="<?= esc_attr($data['value']) ?>" |
| | | <?= $inputAttrs ?> |
| | | <?= $customData?> |
| | | <?= $pattern?> |
| | | > |
| | | <span class="validation-icon success" hidden aria-hidden="true"> |
| | | <?= jvbIcon('check-circle') ?> |
| | |
| | | { |
| | | 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] ?? ''; |
| | |
| | | |
| | | // Build accept attribute for input |
| | | $acceptExtensions = $this->getMimeExtensions($acceptedTypes); |
| | | $acceptAttr = implode(',', $acceptExtensions); |
| | | $acceptAttr = implode(',', $acceptedTypes); |
| | | |
| | | // Determine field attributes |
| | | $subtype = $config['subtype'] ?? 'image'; |
| | |
| | | <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', |
| | |
| | | '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); |
| | |
| | | <?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> |
| | |
| | | <?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> |
| | |
| | | |
| | | // 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']; |
| | | } |