| | |
| | | protected static function handleCustomDatasets($config):string |
| | | { |
| | | if (array_key_exists('data', $config) && !empty($config['data'])) { |
| | | $datasets = array_map(function ($key) use ($config) { |
| | | $datasets = array_map(function ($value, $key) use ($config) { |
| | | $name = str_replace('_', '-', sanitize_title($key)); |
| | | return ' data-'.$name.'="'.$config['data'][$key].'"'; |
| | | }, $config['data']); |
| | | return ' data-'.$name.'="'.$value.'"'; |
| | | }, array_values($config['data']), array_keys($config['data'])); |
| | | |
| | | return implode($datasets); |
| | | } |
| | |
| | | } |
| | | $config['data']['upload-field'] = ''; |
| | | $config['data']['type'] = $config['multiple'] ? 'gallery' : 'single'; |
| | | $plural = 'images'; |
| | | $singular = 'image'; |
| | | if (!empty($config['content'])) { |
| | | $config['data']['content'] = $config['content']; |
| | | $content = $config['content']; |
| | | |
| | | $config['data']['content'] = $content; |
| | | $plural = |
| | | JVB_CONTENT[$content]['plural'] |
| | | ?? JVB_TAXONOMY[$content]['plural'] |
| | | ?? JVB_USER[$content]['plural'] |
| | | ?? str_replace('_', ' ', $content) . 's'; |
| | | |
| | | $singular = JVB_CONTENT[$content]['singular'] |
| | | ?? JVB_TAXONOMY[$content]['singular'] |
| | | ?? JVB_USER[$content]['singular'] |
| | | ?? str_replace('_', ' ',$config['content']); |
| | | } |
| | | if ($config['limit'] > 0) { |
| | | $config['data']['limit'] = $config['limit']; |
| | |
| | | <input type="file" |
| | | %s |
| | | accept="%s" |
| | | data-max-size="%s"> |
| | | data-max-size="%s" |
| | | data-ignore> |
| | | <h2>%s</h2> |
| | | %s |
| | | <p class="file-upload-text"> |
| | |
| | | esc_html(static::getAcceptedTypesLabel($config)), |
| | | esc_html(static::formatFileSize(static::getMaxFileSize($config))) |
| | | ); |
| | | $plural = (array_key_exists($config['content'], JVB_CONTENT)) ? JVB_CONTENT[$config['content']]['plural'] : (array_key_exists($config['content'], JVB_TAXONOMY) ? JVB_TAXONOMY[$config['content']]['plural'] : str_replace('_', ' ',$config['content']).'s'); |
| | | $singular = (array_key_exists($config['content'], JVB_CONTENT)) ? JVB_CONTENT[$config['content']]['singular'] : (array_key_exists($config['content'], JVB_TAXONOMY) ? JVB_TAXONOMY[$config['content']]['singular'] : str_replace('_', ' ',$config['content'])); |
| | | |
| | | |
| | | if ($config['destination'] === 'post_group') { |
| | | $input .= sprintf( |
| | | '<p class="hint">You can group images to create separate %s.</p> |
| | |
| | | ] |
| | | ]; |
| | | |
| | | $out .= static::render('image_data', $fields); |
| | | $out .= static::render('image_data', '', $fields); |
| | | $out .= static::renderUploadItemMetaEnd(); |
| | | |
| | | if ($additionalFields) { |
| | |
| | | ] |
| | | ]; |
| | | |
| | | $out .= static::render('image_data', $fields); |
| | | $out .= static::render('image_data', '', $fields); |
| | | $out .= static::renderUploadItemMetaEnd(); |
| | | |
| | | if ($additionalFields) { |
| | |
| | | ] |
| | | ]; |
| | | |
| | | $out .= static::render('image_data', $fields); |
| | | $out .= static::render('image_data', '', $fields); |
| | | |
| | | $out .= static::renderUploadItemMetaEnd(); |
| | | if ($additionalFields) { |
| | |
| | | protected static function renderGroup(string $name, mixed $value, array $config): string |
| | | { |
| | | $fields = $config['fields'] ?? []; |
| | | error_log('Group fields: '.print_r($fields, true)); |
| | | $values = is_array($value) ? $value : []; |
| | | |
| | | $wrapper = (array_key_exists('wrap', $config)) ? 'details' : 'fieldset'; |