private function buildNodeProperties(NodeInterface $node)
{
$encodedProperties = [];
foreach ($node->getNodeType()->getProperties() as $propertyName => $propertyConfiguration) {
if (substr($propertyName, 0, 2) === '__') {
// skip fully-private properties
continue;
}
/** @var $contentContext ContentContext */
$contentContext = $node->getContext();
if ($propertyName === '_name' && $node === $contentContext->getCurrentSiteNode()) {
// skip the node name of the site node
continue;
}
if ($propertyName === '_nodeType') {
// skip the node type as it is handled separately
continue;
}
// Serialize objects to JSON strings
$dataType = isset($propertyConfiguration['type']) ? $propertyConfiguration['type'] : 'string';
$encodedProperties[$propertyName] = $this->buildNodeProperty($node, $propertyName, $dataType);
}
return $encodedProperties;
}