localeResolver = $localeResolver; $this->mainHelper = $mainHelper; $this->payment = $payment; $this->session = $session; $this->coreHelper = $coreHelper; $this->request = $request; $this->payment->setMethodCode($this->payment::CODE); } /** * @return bool */ protected function shouldRender() { if ($this->getIsCart() && $this->payment->isActive($this->session->getQuote()->getStoreId())) { return true; } return $this->coreHelper->isPayButtonAvailableInMinicart() && $this->payment->isActive($this->session->getQuote()->getStoreId()) && $this->isMiniCart; } /** * @inheritdoc */ protected function _toHtml() { if (!$this->shouldRender()) { return ''; } return parent::_toHtml(); } protected function _isOnCartPage() { return $this->request->getFullActionName() == 'checkout_cart_index'; } /** * @return string */ public function getAddToCartSelector() { return $this->getData(self::CART_BUTTON_ELEMENT_INDEX); } /** * @return string */ public function getImageUrl() { return $this->config->getExpressCheckoutInContextImageUrl( $this->localeResolver->getLocale() ); } /** * Get shortcut alias * * @return string */ public function getAlias() { return $this->getData(self::ALIAS_ELEMENT_INDEX); } /** * @param bool $isCatalog * @return $this */ public function setIsInCatalogProduct($isCatalog) { $this->isMiniCart = !$isCatalog; return $this; } }