diff --git a/src/Controller/CalendarRorController.php b/src/Controller/CalendarRorController.php index 020b683..04545f9 100644 --- a/src/Controller/CalendarRorController.php +++ b/src/Controller/CalendarRorController.php @@ -34,9 +34,15 @@ class CalendarRorController extends ControllerBase { $nodes_e = \Drupal\node\Entity\Node::loadMultiple($nids); $data['nodes'] = array(); foreach($nodes_e as $nid => $node) { - $data['nodes'][$nid] = $node->toArray(); + $na = $node->toArray(); + if(count($na['body']) > 0) { // c'e' gente che pubblica articoli senza body + $body = $na['body'][0]['value']; + } else { + $body = ''; + } + $data['nodes'][$nid] = $na; $data['nodes'][$nid]['summary'] = htmlspecialchars(substr( - html_entity_decode(strip_tags($data['nodes'][$nid]['body'][0]['value'])), + html_entity_decode(strip_tags($body)), 0, 3500), ENT_XML1, 'UTF-8'); }