Commit 9d868fb6482d186b0af4656cded105ae825a361e

Authored by alex
1 parent d6b04401

Поменял логику работы виджета Parthenr 2

frontend/web/img/test1.jpg 0 → 100644

144 KB

frontend/widgets/views/_parthnerList.php
@@ -12,17 +12,21 @@ use yii\helpers\Url; @@ -12,17 +12,21 @@ use yii\helpers\Url;
12 <ul class="owl-carousel customers" > 12 <ul class="owl-carousel customers" >
13 <?php ?> 13 <?php ?>
14 <?php foreach ($data as $parthner):?> 14 <?php foreach ($data as $parthner):?>
15 - <?php  
16 15
17 - $filePath=(file_exists(Url::to("@web/img/".$parthner->image->fileName)))  
18 - ?Url::to("@web/img/".$parthner->image->fileName):  
19 - Url::to("@web/img/no-image.png"); 16 + <?php
  17 + $logo = null;
  18 + if ($parthner->image) {
  19 + $logo_img = ImageManager::findOne($parthner->image->id);
  20 + if ($logo_img) {
  21 + $logo = $logo_img->getImagePathPrivate() ?? $logo;
  22 + }
  23 + }
  24 + $file = $logo;
20 ?> 25 ?>
21 26
22 27
23 -  
24 <li class="item"> 28 <li class="item">
25 - <a target="_blank" href="<?=$parthner->link;?>"><img src="<?=Url::to("@web/img/".$parthner->image->fileName,true)?>" alt="" class="img-responsive"></a> 29 + <a target="_blank" href="<?= $parthner->link; ?>"><img src="<?= $file; ?>" alt="" class="img-responsive"></a>
26 </li> 30 </li>
27 <?php endforeach;?> 31 <?php endforeach;?>
28 </ul> 32 </ul>
29 \ No newline at end of file 33 \ No newline at end of file