[ 'type' => 'string', 'sanitize' => 'sanitize_text_field', 'default' => '', ], 'textarea' => [ 'type' => 'string', 'sanitize' => 'wp_kses_post', 'default' => '', ], 'number' => [ 'type' => 'integer', 'sanitize' => 'sanitizeFloat', 'default' => 0, ], 'set' => [ 'type' => 'string', 'sanitize' => 'sanitizeOptions', 'default' => '', ], 'checkbox' => [ 'type' => 'string', 'sanitize' => 'sanitizeOptions', 'default' => '', ], 'select' => [ 'type' => 'string', 'sanitize' => 'sanitizeOptions', 'default' => '', ], 'radio' => [ 'type' => 'string', 'sanitize' => 'sanitizeOptions', 'default' => '', ], 'email' => [ 'type' => 'string', 'sanitize' => 'sanitize_email', 'default' => '', ], 'phone' => [ 'type' => 'string', 'sanitize' => 'sanitizeTelephone', 'default' => '', ], 'url' => [ 'type' => 'string', 'sanitize' => 'esc_url_raw', 'default' => '', ], 'upload' => [ 'type' => 'string', 'sanitize' => 'sanitizeUpload', 'default' => '', ], 'image' => [ 'type' => 'integer', 'sanitize' => 'absint', 'default' => 0, ], 'gallery' => [ 'type' => 'string', 'sanitize' => 'sanitizeGallery', 'default' => '', ], 'taxonomy' => [ 'type' => 'string', 'sanitize' => 'sanitizeTaxonomy', 'default' => '', ], 'user' => [ 'type' => 'string', 'sanitize' => 'sanitizeUser', 'default' => '', ], 'post' => [ 'type' => 'string', 'sanitize' => 'sanitizePost', 'default' => '', ], 'repeater' => [ 'type' => 'object', 'sanitize' => 'sanitizeRepeater', 'default' => [], ], 'taglist' => [ 'type' => 'object', 'sanitize' => 'sanitizeTagList', 'default' => [] ], 'group' => [ 'type' => 'object', 'sanitize' => 'sanitizeGroup', 'default' => [] ], 'location' => [ 'type' => 'object', 'sanitize' => 'sanitizeLocation', 'default' => [ 'address' => '', 'lat' => 0, 'lng' => 0 ] ], 'date' => [ 'type' => 'string', 'sanitize' => 'sanitizeDate', 'default' => '', ], 'time' => [ 'type' => 'string', 'sanitize' => 'sanitizeTime', 'default' => '', ], 'datetime' => [ 'type' => 'string', 'sanitize' => 'sanitizeDateTime', 'default' => '', ], 'true_false' => [ 'type' => 'boolean', 'sanitize' => 'rest_sanitize_boolean', 'default' => 0, ], 'callback'=> [ 'type' => 'string', 'sanitize' => 'sanitize_text_field', 'default' => '', ], 'selector' => [ 'type' => 'string', 'sanitize' => 'sanitizeSelector', 'default' => '', ] ]; public static function getType(string $field_name):array { return static::$type_map[$field_name]??[]; } public static function getMetaType(string $field_type):string { return static::$type_map[$field_type]['type'] ?? 'string'; } public static function getSanitizeCallback(string $field_type):string { return static::$type_map[$field_type]['sanitize'] ?? 'sanitize_text_field'; } public static function registerType(string $type, array $config):void { static::$type_map[$type] = $config; } public static function getTypes():array { return static::$type_map; } }