- Issue created by @longwave
Since 🐛 SDC slots not being validated against json config schema Active landed in 11.1.7, empty slots, represented in Drupal by an empty array, give an error in SDCs when validated by ComponentValidator:
[slots.test-slot] Array value found, but an object is required
As soon as the slot contains any key-value pairs, this error goes away. This is because this method call converts associative arrays to objects, but leaves empty arrays as arrays:
$definition_object = Validator::arrayToObjectRecursive($definition);
We already have some code to handle this for props but not slots:
// If there are no props, force casting to object instead of array.
if (($schema['properties'] ?? NULL) === []) {
$schema['properties'] = new \stdClass();
}
Add similar defensive code for slots.
Active
11.0 🔥
single-directory components