FIX gente che mette articoli senza body

This commit is contained in:
root 2019-08-04 18:11:15 +02:00
parent b2fc8092bb
commit 77e80ee160

View file

@ -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']
);
}