public function getTemplateVars() { $ret = parent::getTemplateVars(); $ret['image'] = $this->getData(); $imageCaptionSetting = $this->_getSetting('imageCaption'); if ($imageCaptionSetting) { $ret['image_caption'] = $this->_getRow()->image_caption; $ret['showImageCaption'] = $imageCaptionSetting; } $ret['cssClass'] .= ' dimension' . ucfirst($this->getDimensionSetting()); $ret['altText'] = $this->_getAltText(); $imageData = $this->getImageDataOrEmptyImageData(); $ret = array_merge($ret, Kwf_Media_Output_Component::getResponsiveImageVars($this->getImageDimensions(), $imageData['file'])); $ret['baseUrl'] = $this->getBaseImageUrl(); $ret['defineWidth'] = $this->_getSetting('defineWidth'); $ret['lazyLoadOutOfViewport'] = $this->_getSetting('lazyLoadOutOfViewport'); $ret['style'] = 'max-width:' . $ret['width'] . 'px;'; if ($this->_getSetting('defineWidth')) { $ret['style'] .= 'width:' . $ret['width'] . 'px;'; } $ret['containerClass'] = 'container'; if ($ret['width'] > 100) { $ret['containerClass'] .= ' webResponsiveImgLoading'; } if (!$this->_getSetting('lazyLoadOutOfViewport')) { $ret['containerClass'] .= ' loadImmediately'; } return $ret; }
public function getTemplateVars() { $ret = parent::getTemplateVars(); $c = $this->getData()->parent->getComponent(); $size = $c->getImageDimensions(); $ret['width'] = $size['width']; $ret['height'] = $size['height']; $ret['imageUrl'] = $c->getImageUrl(); $ret['options'] = (object) $c->getOptions(); // Next-Previous Links $imageEnlarge = $this->getData()->parent->parent; if (is_instance_of($imageEnlarge->componentClass, 'Kwc_Basic_ImageEnlarge_Component') || is_instance_of($imageEnlarge->componentClass, 'Kwc_Basic_ImageEnlargeParent_Component')) { // Only show links when it's an ImageEnlarge (no LinkTag) $parent = $imageEnlarge->parent; $getChildren = array(); if (is_instance_of($parent->componentClass, 'Kwc_Abstract_List_Component')) { //it's in an List_Gallery } else { if ($parent->parent && is_instance_of($parent->parent->componentClass, 'Kwc_Abstract_List_Component')) { //it's in an List_Switch with ImageEnlarge as large component (we have to go up one more level) $getChildren = array('-' . $imageEnlarge->id); $imageEnlarge = $imageEnlarge->parent; } } $links = self::getPreviousAndNextImagePage($this->getData()->componentClass, $imageEnlarge, $getChildren); $ret = array_merge($ret, $links); } else { $ret['next'] = null; $ret['previous'] = null; } $imageData = $c->getImageData(); $ret = array_merge($ret, Kwf_Media_Output_Component::getResponsiveImageVars($size, $imageData['file'])); $ret['baseUrl'] = $c->getBaseImageUrl(); return $ret; }
public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer) { $ret = parent::getTemplateVars($renderer); $ret['imgCssClass'] = $this->_getSetting('imgCssClass'); $ret['style'] = ''; $ret['containerClass'] = $this->_getBemClass("container"); $ret['image'] = $this->getData(); $imageComponent = $this->_getImageComponent(); if ($imageComponent) { $ret['altText'] = $imageComponent->getAltText(); $imageData = $this->getImageData(); $ret = array_merge($ret, Kwf_Media_Output_Component::getResponsiveImageVars($this->getImageDimensions(), $imageData['file'])); $ret['style'] .= 'max-width:' . $ret['width'] . 'px;'; if ($this->_getSetting('defineWidth')) { $ret['style'] .= 'width:' . $ret['width'] . 'px;'; } if ($ret['width'] > 100) { $ret['containerClass'] .= ' kwfUp-webResponsiveImgLoading'; } } $ret['baseUrl'] = $this->_getBaseImageUrl(); $ret['defineWidth'] = $this->_getSetting('defineWidth'); $ret['lazyLoadOutOfViewport'] = $this->_getSetting('lazyLoadOutOfViewport'); $ret['outputImgTag'] = $this->_getSetting('outputImgTag'); if (!$this->_getSetting('lazyLoadOutOfViewport')) { $ret['containerClass'] .= ' kwfUp-loadImmediately'; } if (!$renderer instanceof Kwf_Component_Renderer_Mail) { //TODO this check is a hack $ret['template'] = Kwf_Component_Renderer_Twig_TemplateLocator::getComponentTemplate('Kwc_Abstract_Image_Component'); } return $ret; }
public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer) { $ret = parent::getTemplateVars($renderer); $ret['image'] = $this->getData(); $imageCaptionSetting = $this->_getSetting('imageCaption'); if ($imageCaptionSetting) { $ret['image_caption'] = $this->_getRow()->image_caption; $ret['showImageCaption'] = $imageCaptionSetting; $ret['rootElementClass'] .= ' showImageCaption'; } $ret['rootElementClass'] .= ' dimension' . ucfirst($this->getDimensionSetting()); $ret['rootElementClass'] .= ' ' . $this->_getSetting('loadedAnimationClass'); $ret['altText'] = $this->_getAltText(); $imageData = $this->getImageDataOrEmptyImageData(); $ret = array_merge($ret, Kwf_Media_Output_Component::getResponsiveImageVars($this->getImageDimensions(), $imageData['dimensions'])); $ret['baseUrl'] = $this->getBaseImageUrl(); $ret['defineWidth'] = $this->_getSetting('defineWidth'); $ret['lazyLoadOutOfViewport'] = $this->_getSetting('lazyLoadOutOfViewport'); $ret['outputImgTag'] = $this->_getSetting('outputImgTag'); $ret['inlineTags'] = $this->_getSetting('inlineTags'); $ret['style'] = ''; $ret['captionStyle'] = ''; if ($this->_getSetting('maxWidthImageWidth')) { $ret['style'] = 'max-width:' . $ret['width'] . 'px;'; $ret['captionStyle'] = 'max-width:' . $ret['width'] . 'px;'; } if ($this->_getSetting('defineWidth')) { $ret['style'] .= 'width:' . $ret['width'] . 'px;'; } $ret['containerClass'] = $this->_getBemClass("container") . ' kwfUp-kwcImageContainer '; if (!$this->_getSetting('lazyLoadOutOfViewport')) { $ret['containerClass'] .= ' kwfUp-loadImmediately'; } $ret['imgCssClass'] = $this->_getSetting('imgCssClass'); $ret['imgAttributes'] = array(); if ($ret['imgCssClass']) { $ret['imgAttributes']['class'] = $ret['imgCssClass']; } if ($titleText = $this->_getTitleText()) { $ret['imgAttributes']['title'] = $titleText; } return $ret; }