| | |
| | | } |
| | | |
| | | $input .= '</div>'; // closes .file-upload-container |
| | | |
| | | $input .= sprintf( |
| | | '<input type="hidden" name="%s" value="%s">', |
| | | esc_attr($name), |
| | | esc_attr(!empty($attachmentIds) ? implode(',', $attachmentIds) : '') |
| | | ); |
| | | |
| | | unset($config['description']); |
| | | unset($config['label']); |
| | | return static::fieldWrap($name, $input, $config); |
| | |
| | | |
| | | $input = sprintf( |
| | | '<div class="row btw"> |
| | | <label for="%s-autocomplete">%s<span>%s</span></label>', |
| | | <input type="hidden" name="%s" value="%s"> |
| | | <label for="%s-autocomplete">%s<span>%s</span></label>', |
| | | esc_attr($name), |
| | | esc_attr(!empty($ids) ? implode(',', $ids) : ''), |
| | | esc_attr($name), |
| | | jvbIcon($icon), |
| | | esc_html($config['label']), |
| | |
| | | } |
| | | $plural = static::getPlural($config); |
| | | $input .= sprintf( |
| | | '<div class="selected-item row" role="region" aria-label="Selected %s"></div>', |
| | | '<div class="selected-items row" role="region" aria-label="Selected %s"></div>', |
| | | $plural[1]??'' |
| | | ); |
| | | |
| | | $input .= '</div>'; //Close the first div.row.btw |
| | | |
| | | $config['type'] = 'selector'; |
| | | unset($config['label']); |
| | | unset($config['description']); |
| | | unset($config['hint']); |
| | | $config['skipInput'] = true; |
| | | return static::fieldWrap($containerId, $input, $config); |
| | | return static::fieldWrap($name, $input, $config); |
| | | } |
| | | |
| | | protected static function getPlural(array $config):array |
| | |
| | | } |
| | | protected static function buildSelectorAutocomplete(string $name, array $config): string |
| | | { |
| | | $containerId = sprintf('%s-%s-selector', $name, $config['subtype'] ?? $config['type']); |
| | | return sprintf( |
| | | '<input type="hidden" name="%s" value=""> |
| | | <input type="search" id="%s-autocomplete" autocomplete="off" data-ignore data-autocomplete> |
| | | '<input type="search" id="%s-autocomplete" autocomplete="off" data-ignore data-autocomplete> |
| | | <p class="message" hidden aria-live="polite">{ <span>Loading items</span> }</p> |
| | | <div class="auto-wrapper" hidden><ul class="search-results"></ul><button class="submit-term" hidden data-ignore><strong>Create: </strong> "<span></span>"</button></div>', |
| | | esc_attr($containerId), |
| | | esc_attr($name) |
| | | ); |
| | | } |
| | |
| | | array_key_exists('add_label', $config) ? $config['add_label'] : 'Add Item' |
| | | ); |
| | | |
| | | unset($config['label']); |
| | | return static::fieldWrap($name, $input, $config); |
| | | } |
| | | protected static function renderRepeaterRow(array $fields, array $values, int|string $index, string $name, string $rowTitle='New Item'):string |