/** * Handles shortcode * @param $atts * @param null $content * @return string * */ public function handle($atts, $content = null) { extract(shortcode_atts($this->extractShortcodeAttributes($atts), $atts)); $mainContainerAtts = array('class' => array('galleryContainer', 'row', $class), 'href' => $image, 'data-rel' => ctGalleryGroupShortcode::getPrettyPhotoId()); $firstItem = false; if (ctGalleryGroupItemShortcode::$counter == 0) { /** @var $image string */ ctGalleryGroupItemShortcode::$firstImageSrc = $image; $firstItem = true; } if ($firstItem == false) { $html = ' <a ' . $this->buildContainerAttributes($mainContainerAtts, $atts) . '> ' . do_shortcode('[img src="' . $image . '" alt=" "][/img]') . ' </a> '; } else { $html = ''; $firstItem = false; } ctGalleryGroupItemShortcode::$counter++; return $html; }
/** * Handles shortcode * @param $atts * @param null $content * @return string */ public function handle($atts, $content = null) { $attributes = shortcode_atts($this->extractShortcodeAttributes($atts), $atts); extract($attributes); $this->addInlineJS($this->getInlineJS($attributes, $id = null), true); $mainContainerAtts = array('class' => array('galleryContainer', 'row', $class)); ctGalleryGroupItemShortcode::setCounterReset(); $null = do_shortcode($content); $itemsCount = call_user_func('ctGalleryGroupItemShortcode::getCounter'); $firstImageSrc = call_user_func('ctGalleryGroupItemShortcode::getFirstImageSrc'); ctGalleryGroupItemShortcode::setCounterReset(); ctGalleryGroupShortcode::$prettyPhotoId = 'prettyPhoto[gallery' . rand(0, 999) . '])'; $cover_image = $cover_image ? $cover_image : $firstImageSrc; $html = ' <ul ' . $this->buildContainerAttributes($mainContainerAtts, $atts) . '> <li class="col-md-3 col-sm-6"> <div class="galleryBox"> <div class="top"> <span class="gallery_title_container"><span class="gallery_title_bg"><span>' . $title . '</span></span></span> </div> <div class="inner"> <a href="' . $firstImageSrc . '" data-rel="' . ctGalleryGroupShortcode::$prettyPhotoId . '"> <img src="' . $cover_image . '" alt=" "> <div><span>' . $itemsCount . ' images</span></div> </a> </div> <div class="hiddenGallery"> ' . do_shortcode($content) . ' </div> </div> </li></ul> '; return $html; }