<?php
/**
 * @var $post \app\models\News
 * @var \yii\data\ActiveDataProvider $newsDataProvider
 * @var \app\models\base\NewsTopic | \app\models\base\Story $topic
 * @var \app\models\Design $design
 */
/*
$newsDataProvider = new \yii\data\ActiveDataProvider(
    [
        "query"=>\app\models\Kd::find()->orderBy(["order"=>SORT_ASC])->offset(3)->limit(3),
        "pagination" => false
    ]
);*/
//$sort = $newsDataProvider->getModels();
/*
$news = new \yii\data\ActiveDataProvider();
$models = [];
foreach( $sort as $item ){
	$models[] = \app\models\News::findOne($item->id);
}
$news->setModels($models);
*/

use yii\helpers\Html;

echo "<!-- 3 новости в ряд -->";
if(!is_null($design->parent)){
    echo Html::tag('h2',Html::a($design->parent->title,[$design->parent->getUrl()]),['class'=>"widget-title mt-2 text-center"]);
}
echo Html::beginTag("div",["class"=>"partner-news row"]);

echo Yii::$app->cache->getOrSet("main-page-third-row-l2-".$design->id,function () use ($newsDataProvider){

    return \yii\widgets\ListView::widget([
        "dataProvider" => $newsDataProvider,
        'options' => [
            'tag' => false,
            'class' => 'list-wrapper',
            'id' => 'list-wrapper',
        ],
        "itemOptions"=>[
            "tag"=>false
        ],
        "itemView" => "_partner_news_item",
        "layout" => "{items}"
    ]);
},60);

echo \yii\helpers\Html::endTag("div");
