protected function renderNodePropertyAttribute(NodeInterface $node, $propertyName)
{
$attributes = [];
/** @var $contentContext ContentContext */
$contentContext = $node->getContext();
// skip the node name of the site node - TODO: Why do we need this?
if ($propertyName === '_name' && $node === $contentContext->getCurrentSiteNode()) {
return $attributes;
}
$dataType = $node->getNodeType()->getPropertyType($propertyName);
$dasherizedPropertyName = $this->dasherize($propertyName);
$propertyValue = $this->nodePropertyConverterService->getProperty($node, $propertyName);
$propertyValue = $propertyValue === null ? '' : $propertyValue;
$propertyValue = !is_string($propertyValue) ? json_encode($propertyValue) : $propertyValue;
if ($dataType !== 'string') {
$attributes['data-nodedatatype-' . $dasherizedPropertyName] = 'xsd:' . $dataType;
}
$attributes['data-node-' . $dasherizedPropertyName] = $propertyValue;
return $attributes;
}