| | |
| | | foreach ($this->registrar->getFields(false) as $name => $config) {
|
| | | $metaType = $this->getSchemaType($config);
|
| | |
|
| | | $schema = $metaType === 'array' ? $this->determineSchema($config) : true;
|
| | | $rawSchema = in_array($metaType, ['array', 'object'], true)
|
| | | ? $this->determineSchema($config)
|
| | | : true;
|
| | |
|
| | | $schema = is_array($rawSchema) ? $this->schema($rawSchema) : $rawSchema;
|
| | | //Allow for null
|
| | | if ($metaType === 'object') {
|
| | | $metaType = ['object', 'null'];
|
| | | }
|
| | | register_post_meta($this->registrar->getBased(), jvbCheckBase($name), [
|
| | | 'single' => true,
|
| | | 'type' => $metaType,
|
| | |
| | | $required[] = $name;
|
| | | }
|
| | |
|
| | | $schema = $this->determineSchema($c);
|
| | | if (is_array($schema)) {
|
| | | if (array_key_exists('default', $schema)) {
|
| | | $args['default'] = $schema['default'];
|
| | | $tmp = $this->determineSchema($c);
|
| | | if (is_array($tmp)) {
|
| | | if (array_key_exists('default', $tmp)) {
|
| | | $args['default'] = $tmp['default'];
|
| | | }
|
| | | if (array_key_exists('enum', $schema)) {
|
| | | $args['enum'] = $schema['enum'];
|
| | | if (array_key_exists('enum', $tmp)) {
|
| | | $args['enum'] = $tmp['enum'];
|
| | | }
|
| | | if (array_key_exists('format', $schema)) {
|
| | | $args['format'] = $schema['format'];
|
| | | if (array_key_exists('format', $tmp)) {
|
| | | $args['format'] = $tmp['format'];
|
| | | }
|
| | | }
|
| | | if (array_key_exists('default', $c)) {
|
| | |
| | | protected function schemaLocation(array $config):array|true
|
| | | {
|
| | | return [
|
| | | 'type' => 'object',
|
| | | 'type' => ['object', 'null'],
|
| | | 'properties' => [
|
| | | 'address' => [
|
| | | 'type' => 'string'
|