protected function NormalizerBase::normalizeProperties in Schemata 8
Normalize an array of data definitions.
This normalization process gets an array of properties and an array of properties that are required by name. This is needed by the SchemataSchemaNormalizer, otherwise it would have been placed in DataDefinitionNormalizer.
Parameters
\Drupal\Core\TypedData\DataDefinitionInterface[] $items: An array of data definition properties to be normalized.
string $format: Format identifier of the current serialization process.
array $context: Operating context of the serializer.
Return value
array Array containing one or two nested arrays.
- properties: The array of all normalized properties.
- required: The array of required properties by name.
3 calls to NormalizerBase::normalizeProperties()
- ComplexDataDefinitionNormalizer::normalize in schemata_json_schema/
src/ Normalizer/ json/ ComplexDataDefinitionNormalizer.php - Normalizes an object into a set of arrays/scalars.
- ComplexDataDefinitionNormalizer::normalize in schemata_json_schema/
src/ Normalizer/ jsonapi/ ComplexDataDefinitionNormalizer.php - Normalizes an object into a set of arrays/scalars.
- SchemataSchemaNormalizer::normalize in schemata_json_schema/
src/ Normalizer/ json/ SchemataSchemaNormalizer.php - Normalizes an object into a set of arrays/scalars.
File
- src/
Normalizer/ NormalizerBase.php, line 50
Class
- NormalizerBase
- Base class for JSON Schema Normalizers.
Namespace
Drupal\schemata\NormalizerCode
protected function normalizeProperties(array $items, $format, array $context = []) {
$normalized = [];
foreach ($items as $name => $property) {
$context['name'] = $name;
$item = $this->serializer
->normalize($property, $format, $context);
if (!empty($item)) {
$normalized = NestedArray::mergeDeep($normalized, $item);
}
}
return $normalized;
}