/** * @param \Render\APIs\APIv1\RenderAPI $renderApi * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function renderContent($renderApi, $unit, $moduleInfo) { $responsiveImage = new ResponsiveImageBuilder($renderApi, $unit, $moduleInfo); $imageIds = $renderApi->getFormValue($unit, 'sliderImageIds', array()); $imageQuality = null; if ($renderApi->getFormValue($unit, 'enableImageQuality')) { $imageQuality = $renderApi->getFormValue($unit, 'imageQuality'); } $globalHeightPercent = str_replace('%', '', $renderApi->getFormValue($unit, 'imgHeight')); // render children (non extensions) if (count($imageIds) > 0) { echo '<ul class="slides">'; $i = 0; foreach ($imageIds as $imageId) { // image try { $image = $renderApi->getMediaItem($imageId)->getImage(); if ($globalHeightPercent == 0) { $heightPercent = $image->getHeight() / $image->getWidth() * 100; } else { $heightPercent = $globalHeightPercent; } $cropHeight = $image->getWidth() * $heightPercent / 100; // slides if ($i == 0) { echo '<li class="slide slideActive">'; } else { echo '<li class="slide">'; } $i++; // image tag $imgTag = $responsiveImage->getImageTag($image, array('resize' => array('width' => $image->getWidth(), 'height' => $cropHeight), 'quality' => $imageQuality)); if (isset($imgTag)) { echo $imgTag->toString(); } echo '</li>'; } catch (\Exception $e) { } } echo '</ul>'; } else { if ($renderApi->isEditMode()) { // missing input hint $i18n = new Translator($renderApi, $moduleInfo); echo '<div class="RUKZUKmissingInputHint">'; echo '<div>'; echo '<button onclick="javascript:CMS.openFormPanel(\'sliderImageIds\');">'; echo $i18n->translate('button.missingInputHint', 'Choose images'); echo '</button>'; echo '</div>'; echo '</div>'; } } $renderApi->renderChildren($unit); }
/** * @param \Render\APIs\APIv1\RenderAPI $api * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function render($api, $unit, $moduleInfo) { echo "START-RENDER:" . $unit->getId() . "\n"; echo "ASSET-PATH:" . $moduleInfo->getAssetPath('assetPath') . "\n"; echo "ASSET-URL:" . $moduleInfo->getAssetUrl('assetUrl') . "\n"; try { $url = $api->getMediaItem('ITEM-NOT-EXISTS')->getUrl(); } catch (\Exception $ignore) { $url = '#exception'; } echo "NOT-EXISTS-MEDIA-URL:" . $url . "\n"; $api->renderChildren($unit); echo "END-RENDER:" . $unit->getId() . "\n"; }
/** * @param \Render\APIs\APIv1\RenderAPI $renderApi * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function renderContent($renderApi, $unit, $moduleInfo) { $embedCode = $renderApi->getFormValue($unit, 'htmlCode'); if (!empty($embedCode)) { try { $attributes = $this->extractAttributes($embedCode); echo $this->renderVideo($attributes['src'], $attributes['ratio']); } catch (\Exception $e) { // in case of errors just echo the entered code echo $embedCode; } } $renderApi->renderChildren($unit); }
/** * @param \Render\APIs\APIv1\RenderAPI $api * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function render($api, $unit, $moduleInfo) { echo "START-RENDER:" . $unit->getId() . "\n"; echo "ASSET-PATH:" . $moduleInfo->getAssetPath('assetPath') . "\n"; echo "ASSET-URL:" . $moduleInfo->getAssetUrl('assetUrl') . "\n"; echo "MEDIA-URL:" . $api->getMediaItem($api->getFormValue($unit, 'download'))->getUrl() . "\n"; echo "IMAGE-URL:" . $api->getMediaItem($api->getFormValue($unit, 'image'))->getImage()->resizeCenter(100, 100)->getUrl() . "\n"; try { $url = $api->getMediaItem('ITEM-NOT-EXISTS')->getUrl(); } catch (\Exception $ignore) { $url = '#exception'; } echo "NOT-EXISTS-MEDIA-URL:" . $url . "\n"; $api->renderChildren($unit); echo "END-RENDER:" . $unit->getId() . "\n"; }
/** * @param \Render\APIs\APIv1\RenderAPI $renderApi * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function renderContent($renderApi, $unit, $moduleInfo) { $imgClass = ''; $svgUrl = $moduleInfo->getAssetUrl('imageBlank.svg'); $svgMedia = $renderApi->getFormValue($unit, 'svg'); if ($svgMedia == '') { $imgClass = 'blankImgPlaceholder'; } else { try { $svgUrl = $renderApi->getMediaItem($svgMedia)->getUrl(); } catch (\Exception $e) { } } $svgImgTag = new HtmlTagBuilder('img', array('src' => $svgUrl, 'alt' => $renderApi->getFormValue($unit, 'svgAlt'))); if (!empty($imgClass)) { $svgImgTag->set('class', $imgClass); } $svgTitle = $renderApi->getFormValue($unit, 'svgTitle'); if (!empty($svgTitle)) { $svgImgTag->set('title', $svgTitle); } echo $svgImgTag->toString(); $renderApi->renderChildren($unit); }
/** * @param \Render\APIs\APIv1\RenderAPI $api * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function render($api, $unit, $moduleInfo) { echo "START-RENDER:" . $unit->getId() . "\n"; $api->renderChildren($unit); echo "END-RENDER:" . $unit->getId() . "\n"; }
/** * @param \Render\APIs\APIv1\RenderAPI $renderApi * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ protected function renderContent($renderApi, $unit, $moduleInfo) { $renderApi->renderChildren($unit); }