コード例 #1
0
 /**
  * Vratí ten nejjednodušší seznam obrázků 
  * 
  * @author Jan Pokorný
  * @param array $imgAttrs atributy pro každy img tag
  * @param bool $withSelfLink obalit img tagy odkazy
  * @param array $linkAttrs  atributy pro každy a tag
  * @param string $format  format @see sprintf();
  * @return string (html)
  */
 public function getImageList($imgAttrs = [], $withSelfLink = true, $linkAttrs = [], $format = "%s")
 {
     $html = "";
     if (KT::notIssetOrEmpty($this->getFiles())) {
         return $html;
     }
     foreach ($this->getFiles() as $image) {
         /* @var $image \WP_Post */
         $imgHtml = "";
         if ($withSelfLink) {
             $large = wp_get_attachment_image_src($image->ID, $this->getLargeSize());
             $imgHtml .= $this->getLinkTagToLargeImage($large, $linkAttrs, $image->post_title);
         }
         $imgHtml .= KT::imageGetHtmlByAttachmentId($image->ID, $this->getThumbnailSize(), false, $imgAttrs);
         if ($withSelfLink) {
             $imgHtml .= "</a>";
         }
         $html .= sprintf($format, $imgHtml);
     }
     return $html;
 }