I’m trying to implement the getYouTube Extra, but I can’t get it to show anything. After a look in the error logs, this comes up:
[2019-07-03 00:30:58] (ERROR @ ***/core/components/getyoutube/model/getyoutube/search.class.php : 63) PHP warning: Invalid argument supplied for foreach()
The respective code in the search.class.php
is:
foreach($videos['items'] as $video) {
/* SET PLACEHOLDERS */
$this->modx->setPlaceholder('id',$video['id']['videoId']);
$this->modx->setPlaceholder('url',"https://www.youtube.com/watch?v=" . $video['id']['videoId']);
$this->modx->setPlaceholder('embed_url',"https://www.youtube.com/embed/" . $video['id']['videoId']);
$this->modx->setPlaceholder('title',$video['snippet']['title']);
$this->modx->setPlaceholder('channel_title',$video['snippet']['channelTitle']);
$this->modx->setPlaceholder('description',$video['snippet']['description']);
$this->modx->setPlaceholder('publish_date',$video['snippet']['publishedAt']);
$this->modx->setPlaceholder('thumbnail_small',$video['snippet']['thumbnails']['default']['url']); //120px wide and 90px tall
$this->modx->setPlaceholder('thumbnail_medium',$video['snippet']['thumbnails']['medium']['url']); //320px wide and 180px tall
$this->modx->setPlaceholder('thumbnail_large',$video['snippet']['thumbnails']['high']['url']); //480px wide and 360px tall
/* SET TEMPLATES */
if (!empty($tplAlt)) {
if($idx % 2 == 0) { // Checks if index can be divided by 2 (alt)
$rowTpl = $tpl;
}else{
$rowTpl = $tplAlt;
}
}else{
$rowTpl = $tpl;
}
$idx++; //Increases index by +1
$results .= $this->modx->getChunk($rowTpl,$video);
}
Can someone tell me what the error is referring to?