/** * @param \Render\APIs\RootAPIv1\RootRenderAPI $api * @param \Render\Unit $unit * @param \Render\ModuleInfo $moduleInfo */ public function render($api, $unit, $moduleInfo) { echo "START-RENDER:" . $unit->getId() . "\n"; echo "JS-API:" . $api->getJsApiUrl() . "\n"; echo "CSS-URL:" . $api->getCSSUrl() . "\n"; echo "START-INSERT-CSS:\n"; $api->insertCss($unit); echo "END-INSERT-CSS:\n"; echo "START-MODULE-DATA:\n"; echo json_encode($api->getAllModuleData($unit)); echo "END-MODULE-DATA:\n"; echo "START-UNIT-DATA:\n"; echo json_encode($api->getAllUnitData($unit)); echo "END-UNIT-DATA:\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"; }
/** * Title and Description * @param \Render\APIs\RootAPIv1\RootRenderAPI $rootApi * @param \Render\Unit $rootUnit */ private function insertTitleAndDescription($rootApi, $rootUnit) { // title $nav = $rootApi->getNavigation(); $currentPage = $nav->getPage($nav->getCurrentPageId()); $pageTitle = $currentPage->getTitle(); $title = $rootApi->getFormValue($rootUnit, 'titlePrefix', '') . $pageTitle . $rootApi->getFormValue($rootUnit, 'titleSuffix', ''); echo HtmlTagBuilder::title($title); // description $description = $currentPage->getDescription(); if ($description != '') { echo HtmlTagBuilder::meta()->set(array('name' => 'description', 'content' => $description)); } }