amp-gallery.php 940 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * @var $this \yii\web\View
  4. * @var $gallery \app\models\front\Gallery
  5. */
  6. use yii\helpers\Html;
  7. use yii\helpers\Url;
  8. ?>
  9. <?php if($gallery instanceof \app\models\front\Gallery && count($gallery->getBehavior('galleryBehavior')->getImages())>0 ):?>
  10. <amp-carousel width="450" height="300" layout="responsive" type="slides" role="region" aria-label="<?=Html::encode($gallery->name)?>" >
  11. <?php
  12. foreach($gallery->getBehavior('galleryBehavior')->getImages() as $image):/** @var $image \app\forks\galleryManager\GalleryImage */
  13. if( $image->type == 'post_gallery' ){
  14. ?>
  15. <amp-img src="https://www.amic.ru/<?= $image->getUrl('original')?>" width="450" height="300" alt="<?=Html::encode($image->name)?>"></amp-img>
  16. <?}?>
  17. <?php endforeach;?>
  18. </amp-carousel>
  19. <div class="amp-img-title"><?=$gallery->name?></div>
  20. <?php endif;?>