FIX gente che mette articoli senza body
This commit is contained in:
parent
b2fc8092bb
commit
77e80ee160
1 changed files with 6 additions and 1 deletions
|
@ -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']
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue