Headers.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace fecshop\app\apphtml5\widgets;
  3. use fecshop\interfaces\block\BlockCache;
  4. use Yii;
  5. class Headers implements BlockCache
  6. {
  7. public function getLastData()
  8. {
  9. $currentUrl = Yii::$service->url->getCurrentUrl();
  10. $logoutUrl = Yii::$service->url->getUrl('customer/account/logout', ['rt'=>base64_encode($currentUrl)]);
  11. //$currentLang =
  12. //$currency = Yii::$service->page->currency->getCurrentCurrency();
  13. return [
  14. 'logoutUrl' => $logoutUrl,
  15. 'homeUrl' => Yii::$service->url->homeUrl(),
  16. 'currentBaseUrl' => Yii::$service->url->getCurrentBaseUrl(),
  17. 'currentStore' => Yii::$service->store->currentStore,
  18. 'currentStoreLang' => Yii::$service->store->currentLangName,
  19. 'stores' => Yii::$service->store->getStoresLang(),
  20. 'currency' => Yii::$service->page->currency->getCurrencyInfo(),
  21. 'currencys' => Yii::$service->page->currency->getCurrencys(),
  22. ];
  23. }
  24. public function getCacheKey()
  25. {
  26. $lang = Yii::$service->store->currentLangCode;
  27. $currency = Yii::$service->page->currency->getCurrentCurrency();
  28. $appName = Yii::$service->helper->getAppName();
  29. $cacheKeyName = 'footer';
  30. $currentStore = Yii::$service->store->currentStore;
  31. return self::BLOCK_CACHE_PREFIX.'_'.$currentStore.'_'.$lang.'_'.$currency.'_'.$appName.'_'.$cacheKeyName;
  32. }
  33. }