Get properties, excluding JSON-LD specific properties.
array An array of properties structured as in JSON-LD.
public function getProperties() {
// Properties to skip.
$skip = array(
'id',
);
// Create language map property structure.
foreach ($this->entity
->getTranslationLanguages() as $langcode => $language) {
foreach ($this->entity
->getTranslation($langcode) as $name => $field) {
$definition = $this->entity
->getPropertyDefinition($name);
$langKey = empty($definition['translatable']) ? LANGUAGE_NOT_SPECIFIED : $langcode;
if (!$field
->isEmpty()) {
$properties[$name][$langKey] = $this->serializer
->normalize($field, $this->format);
}
}
}
// Only return properties which are not in the $skip array.
return array_diff_key($properties, array_fill_keys($skip, ''));
}