예제 #1
0
 /**
  * @param HeadAPI          $api
  * @param CartWithShipping $cart
  * @param CartProcessor    $cartProcessor
  *
  * @return string
  */
 protected function getShopMode($api, $cart, $cartProcessor)
 {
     $defaultMode = $api->isTemplate() ? 'checkout' : 'cart';
     if ($cart->totalUniqueItems() <= 0) {
         return $defaultMode;
     }
     $mode = $cartProcessor->getMode($defaultMode);
     return $mode;
 }
예제 #2
0
 /**
  * Build the DynCSS config array for this unit
  * @param \Render\APIs\APIv1\HeadAPI $api
  * @param \Render\Unit $unit
  * @param \Render\ModuleInfo $moduleInfo
  * @return array
  */
 protected function getDynCSSConfig($api, $unit, $moduleInfo)
 {
     // performance improvement as we cache the
     // css in live mode so skip gathering of data
     if ($api->isLiveMode()) {
         return array();
     }
     $selector = $api->getFormValue($unit, 'cssStyleSet');
     if ($selector != '') {
         $result['selector'] = array('.' . $selector);
     }
     return $result;
 }
예제 #3
0
 /**
  * Checks if the given mode matches the current execution context (determined
  * by the current module API), e.g. "edit" is available if and only if
  * <code>$api->isEditMode === TRUE</code>
  *
  * @param string $mode The requested mode (e.g. "edit", "live", ...)
  * @param \Render\APIs\APIv1\HeadAPI $api The current module api
  * @return boolean TRUE if and only if the requested mode is available
  */
 protected function isAvailableInMode($mode, $api)
 {
     if ($mode === 'edit') {
         return $api->isEditMode();
     } else {
         if ($mode === 'live') {
             return !$api->isEditMode();
         } else {
             return TRUE;
         }
     }
 }
예제 #4
0
 /**
  * Checks if the expected website settings will be return
  *
  * @test
  * @group rendering
  * @group small
  * @group dev
  *
  * @expectedException \Render\APIs\APIv1\WebsiteSettingsNotFound
  */
 public function test_getWebsiteSettings_throwExceptionIfWebsiteSettingsNotExists()
 {
     // ARRANGE
     $websiteSettingsId = 'notExistsWebsiteSettings';
     $websiteInfoStorageMock = $this->getWebsiteInfoStorageMock();
     $websiteInfoStorageMock->expects($this->any())->method('getWebsiteSettings')->with($this->equalTo($websiteSettingsId))->will($this->throwException(new WebsiteSettingsDoesNotExists()));
     $renderContextMock = $this->createRenderContextMock();
     $renderContextMock->expects($this->atLeastOnce())->method('getWebsiteInfoStorage')->will($this->returnValue($websiteInfoStorageMock));
     $headAPI = new HeadAPI($renderContextMock);
     // ACT
     $headAPI->getWebsiteSettings($websiteSettingsId);
 }
예제 #5
0
 /**
  * @param HeadAPI    $api
  * @param ModuleInfo $moduleInfo
  *
  * @return Translator
  */
 protected function getTranslator($api, $moduleInfo)
 {
     return new Translator($api, $moduleInfo, $api->getLocale());
 }
예제 #6
0
 /**
  * @param string $pageId
  * @param array  $params
  *
  * @return string
  */
 public function getPageUrl($pageId, array $params = array())
 {
     return $this->api->getNavigation()->getPage($pageId)->getUrl($params);
 }
예제 #7
0
파일: CSSAPI.php 프로젝트: rukzuk/rukzuk
 /**
  * @param NodeTree      $nodeTree
  * @param RenderContext $renderContext
  */
 public function __construct(NodeTree $nodeTree, RenderContext $renderContext)
 {
     parent::__construct($renderContext);
     $this->nodeTree = $nodeTree;
 }