Drupal и instagram posts
Ребята помогите решить задачку
У меня есть контроллер, он выводит мои посты через foreach( echo
как мне вывести мои посты через render array (#theme->item_list)
буду очень благодарен!
вот мой код:
<?php
namespace Drupal\Insta\Controller;
use Drupal\node\Entity\Node;
use Drupal\Core\Url;
use Drupal\Component\Render\FormattableMarkup;
class InstaController{
public function test(){
$token = 'my_token';
$user_id = 'self';
$instagram_cnct = curl_init();
curl_setopt( $instagram_cnct, CURLOPT_URL, "https://api.instagram.com/v1/users/" . $user_id . "/media/recent?access_token=" . $token );
curl_setopt( $instagram_cnct, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $instagram_cnct, CURLOPT_TIMEOUT, 15 );
$media = json_decode( curl_exec( $instagram_cnct ) );
curl_close( $instagram_cnct );
$limit = 2;
$size = 320;
foreach(array_slice($media->data, 0, $limit) as $data) {
echo '<a href="' . $data->link . '" target="_blank">';
echo '<img src="'. $data->images->low_resolution->url . '" height="'.$size.'" width="'.$size.'"/>';
echo '</a>';
}
нашел такое , но как это использовать непойму
$res = array(
'#theme' => 'item_list',
'#items' => $taxonomy_list,
);
return $res;
}
=========================