diff --git a/src/Controller/RelatedRorController.php b/src/Controller/RelatedRorController.php index d925fad..0bbd8a5 100644 --- a/src/Controller/RelatedRorController.php +++ b/src/Controller/RelatedRorController.php @@ -26,12 +26,17 @@ class RelatedRorController extends ControllerBase { } private function nodeToLinkdata($node_entity) { $arr = $node_entity->toArray(); + if(count($arr['body']) > 0) { // c'e' gente che pubblica articoli senza body + $body = $arr['body'][0]['value']; + } else { + $body = ''; + } return array( 'nid' => intval($arr['nid'] [0] ['value']), 'title' => $arr['title'][0]['value'], //'body' => $arr['body'][0] ['value'], 'summary' => htmlspecialchars(substr( - html_entity_decode(strip_tags($arr['body'][0]['value'])), 0, 3500), ENT_XML1, 'UTF-8'), + html_entity_decode(strip_tags($body)), 0, 3500), ENT_XML1, 'UTF-8'), 'url' => $arr['path'][0] ['alias'] ); }