Skip to content
Snippets Groups Projects
Commit a44b825d authored by Rich Lott / Artful Robot's avatar Rich Lott / Artful Robot
Browse files

ArraySchema to support 'empty' pseudo type

parent 4e590556
Branches
Tags
No related merge requests found
......@@ -82,7 +82,7 @@ class ArraySchema {
'//' => [ 'MUST', 'array',
'schema' => [
0 => ['MUST', 'string', 'oneOfStrictly' => ['MUST', 'MAY']],
1 => ['MUST', 'string|NULL', 'regex' => '/^(boolean|integer|integerString|numeric|double|string|array|NULL)([|](boolean|integer|integerString|numeric|double|string|array|NULL))*$/'],
1 => ['MUST', 'string|NULL', 'regex' => '/^(boolean|integer|double|string|array|NULL|integerString|numeric|empty)([|](boolean|integer|double|string|array|NULL|integerString|numeric|empty))*$/'],
'schema' => ['MAY', 'array', 'recurse' => []],
'regex' => ['MAY', 'string'],
'recurse' => ['MAY', 'array', 'schema' => [
......@@ -216,6 +216,10 @@ class ArraySchema {
$typeOK = TRUE;
break;
}
if ($type === 'empty' && empty($value)) {
$typeOK = TRUE;
break;
}
}
if (!$typeOK) {
return [["Expected $expectedTypes but got $actualType", $ancestry, $value]];
......
......@@ -194,6 +194,7 @@ abstract class Type {
// Note: because of the way CRM.url works, you MUST put a ? before the #
return 'civicrm/a?#/inlays/' . static::getTypeMachineName() . '/{id}';
}
/**
* Get the URL template for editing config sets belonging to this inlay type.
*
......@@ -205,6 +206,7 @@ abstract class Type {
// Note: because of the way CRM.url works, you MUST put a ? before the #
return "civicrm/a?#/inlayConfig/$configSetName/{id}";
}
/**
* Load the config from the given Array.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment