| | |
| | | $datasets |
| | | ); |
| | | |
| | | $output .= static::buildCharacterLimit($config); |
| | | $output .= static::buildLabel($name, $config); |
| | | if (!array_key_exists('skipInput', $config)) { |
| | | $output .= static::buildInput($content); |
| | | } |
| | | |
| | | $output .= static::buildHint($config); |
| | | $output .= static::buildCharacterLimit($config); |
| | | $output .= static::buildDescription($name, $config); |
| | | |
| | | $output .= '</div>'; |
| | |
| | | ); |
| | | } |
| | | |
| | | protected static function buildCharacterLimit(array $config): string |
| | | { |
| | | if (empty($config['data']['limit'])) { |
| | | return ''; |
| | | } |
| | | return sprintf( |
| | | '<span class="char-limit"><span class="current">0</span> / <span class="limit">%s</span></span>', |
| | | esc_html($config['data']['limit']) |
| | | ); |
| | | } |
| | | protected static function buildCharacterLimit(array $config): string |
| | | { |
| | | $type = $config['type'] ?? 'text'; |
| | | if (in_array($type, ['upload', 'gallery', 'selector'])) { |
| | | return ''; |
| | | } |
| | | if (empty($config['maxlength'])) { |
| | | return ''; |
| | | } |
| | | return sprintf( |
| | | '<span class="char-limit"><span class="current">0</span> / <span class="limit">%s</span></span>', |
| | | esc_html($config['maxlength']) |
| | | ); |
| | | } |
| | | |
| | | protected static function buildLabel(string $name, array $config):string |
| | | { |
| | |
| | | ?? str_replace('_', ' ',$config['content']); |
| | | } |
| | | if ($config['limit'] > 0) { |
| | | $config['data']['limit'] = $config['limit']; |
| | | $config['data']['max-files'] = $config['limit']; |
| | | } |
| | | |
| | | $attachmentIds = static::parseIds($value); |
| | |
| | | |
| | | $input .= '<div class="file-error"></div>'; |
| | | $input .= jvbRenderProgressBar('', false, true, true); |
| | | $input .= '</div>'; |
| | | |
| | | $input .= '</div>'; // closes .file-upload-wrapper |
| | | |
| | | if ($config['destination'] === 'post_group') { |
| | | $input .= static::renderUploadGroupAreaStart($config, $plural, $singular); |
| | |
| | | $input .= static::renderUploadGroupAreaEnd($config, $plural, $singular); |
| | | } |
| | | |
| | | $input .= '</div>'; // closes .file-upload-container |
| | | unset($config['description']); |
| | | unset($config['label']); |
| | | return static::fieldWrap($name, $input, $config); |