'; foreach ($fields as $field) { self::field($widget, $field, $instance[(string) ($field['id'] ?? '')] ?? ($field['default'] ?? ''), ''); } echo ''; } private static function field(SchemaWidget $widget, array $field, $value, string $parent): void { $type = (string) ($field['type'] ?? 'text'); $id = (string) ($field['id'] ?? ''); if (in_array($type, ['content', 'subheading', 'submessage'], true)) { self::display_field($field, $type); return; } if ($id === '') { return; } $key = $parent === '' ? $id : $parent . '[' . $id . ']'; $field_id = $widget->get_field_id(str_replace(['[', ']'], ['-', ''], $key)); $field_name = $widget->get_field_name($key); $dependency = !empty($field['dependency']) ? wp_json_encode($field['dependency']) : ''; echo '
'; } private static function display_field(array $field, string $type): void { $content = (string) ($field['content'] ?? $field['label'] ?? ''); echo ''; } private static function switcher(string $id, string $name, bool $value): void { echo ''; echo ''; } private static function radios(string $id, string $name, array $options, string $value, string $type): void { echo ''; } private static function select(string $id, string $name, array $field, $value): void { $multiple = !empty($field['multiple']); echo ''; } private static function checkboxes(string $id, string $name, array $field, $value): void { $options = (array) ($field['options'] ?? []); if (!$options) { self::switcher($id, $name, (bool) $value); return; } $values = array_map('strval', (array) $value); foreach ($options as $key => $label) { echo ' '; } } private static function number(string $id, string $name, array $field, $value, string $type): void { $min = isset($field['min']) ? ' min="' . esc_attr((string) $field['min']) . '"' : ''; $max = isset($field['max']) ? ' max="' . esc_attr((string) $field['max']) . '"' : ''; $step = ' step="' . esc_attr((string) ($field['step'] ?? 1)) . '"'; $input_type = $type === 'slider' ? 'range' : 'number'; echo ''; } private static function upload(string $id, string $name, string $value, string $library = ''): void { $library = in_array($library, ['image', 'video'], true) ? $library : ''; echo ''; } private static function link(SchemaWidget $widget, string $key, array $value): void { echo ''; } private static function spacing(SchemaWidget $widget, string $key, array $value): void { echo ''; } private static function background(SchemaWidget $widget, string $key, array $value): void { echo ''; } private static function group(SchemaWidget $widget, array $field, array $rows, string $key): void { $token = '__index_' . substr(md5($key), 0, 8) . '__'; echo ''; } private static function group_row(SchemaWidget $widget, array $field, array $row, string $key, string $index): void { $prefix = (string) ($field['item_label'] ?? $field['label'] ?? __('项目', 'aksrt')); $number = ctype_digit($index) ? ((int) $index + 1) : 0; $title = $prefix . ($number ? ' ' . $number : ''); if (!empty($row['title'])) $title .= ':' . strip_tags((string) $row['title']); echo ''; } private static function nested(SchemaWidget $widget, array $field, array $value, string $key): void { echo ''; } private static function plain_input(SchemaWidget $widget, string $key, string $value, string $type, string $placeholder): void { $name = $widget->get_field_name($key); $id = $widget->get_field_id(str_replace(['[', ']'], ['-', ''], $key)); echo ''; } }