当前位置: 首页>>代码示例>>PHP>>正文


PHP UrlInterface::setScope方法代码示例

本文整理汇总了PHP中Magento\Framework\UrlInterface::setScope方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlInterface::setScope方法的具体用法?PHP UrlInterface::setScope怎么用?PHP UrlInterface::setScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\UrlInterface的用法示例。


在下文中一共展示了UrlInterface::setScope方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getProductUrl

 /**
  * Get product view url
  *
  * @param string|int $productId
  * @param string|int $storeId
  * @return string
  */
 public function getProductUrl($productId, $storeId)
 {
     if ($storeId) {
         $this->_urlModel->setScope($storeId);
     }
     return $this->_urlModel->getUrl('catalog/product/view', ['id' => $productId]);
 }
开发者ID:kid17,项目名称:magento2,代码行数:14,代码来源:Review.php

示例2: getUrl

 /**
  * Get action url
  *
  * @param string $routePath
  * @param string $scope
  * @param string $store
  * @return string
  */
 public function getUrl($routePath, $scope, $store)
 {
     $this->frontendUrlBuilder->setScope($scope);
     $href = $this->frontendUrlBuilder->getUrl($routePath, ['_current' => false, '_query' => '___store=' . $store]);
     return $href;
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:14,代码来源:UrlBuilder.php

示例3: getUrl

 /**
  * Retrieve url using store configuration specific
  *
  * @param   string $route
  * @param   array $params
  * @return  string
  */
 public function getUrl($route = '', $params = [])
 {
     /** @var $url UrlInterface */
     $url = $this->_url->setScope($this);
     if ($this->_storeManager->getStore()->getId() != $this->getId()) {
         $params['_scope_to_url'] = true;
     }
     return $url->getUrl($route, $params);
 }
开发者ID:mrbadao,项目名称:magento-ce,代码行数:16,代码来源:Store.php

示例4: getUrl

 /**
  * Generate URL for the specified store.
  *
  * @param \Magento\Store\Model\Store $store
  * @param string $route
  * @param array $params
  * @return string
  */
 public function getUrl(\Magento\Store\Model\Store $store, $route = '', $params = [])
 {
     $url = $this->urlModel->setScope($store);
     if ($this->storeManager->getStore()->getId() != $store->getId()) {
         $params['_scope_to_url'] = true;
     }
     return $url->getUrl($route, $params);
 }
开发者ID:nja78,项目名称:magento2,代码行数:16,代码来源:AbstractTemplate.php

示例5: initiatePasswordReset

 /**
  * {@inheritdoc}
  */
 public function initiatePasswordReset($email, $template, $websiteId = null)
 {
     if (is_null($websiteId)) {
         $websiteId = $this->storeManager->getStore()->getWebsiteId();
     }
     // load customer by email
     $customer = $this->customerRegistry->retrieveByEmail($email, $websiteId);
     $newPasswordToken = $this->mathRandom->getUniqueHash();
     $customer->changeResetPasswordLinkToken($newPasswordToken);
     $this->url->setScope($customer->getStoreId());
     $resetUrl = $this->url->getUrl('customer/account/createPassword', ['_query' => array('id' => $customer->getId(), 'token' => $newPasswordToken), '_store' => $customer->getStoreId()]);
     $customer->setResetPasswordUrl($resetUrl);
     try {
         switch ($template) {
             case CustomerAccountServiceInterface::EMAIL_REMINDER:
                 $customer->sendPasswordReminderEmail();
                 break;
             case CustomerAccountServiceInterface::EMAIL_RESET:
                 $customer->sendPasswordResetConfirmationEmail();
                 break;
             default:
                 throw new InputException(InputException::INVALID_FIELD_VALUE, ['value' => $template, 'fieldName' => 'email type']);
         }
     } catch (MailException $e) {
         // If we are not able to send a reset password email, this should be ignored
         $this->logger->logException($e);
     }
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:31,代码来源:CustomerAccountService.php

示例6: getUnsubscribeUrl

 /**
  * Retrieve unsubsription url
  *
  * @param \Magento\Newsletter\Model\Subscriber $subscriber
  * @return string
  */
 public function getUnsubscribeUrl($subscriber)
 {
     return $this->_frontendUrlBuilder->setScope($subscriber->getStoreId())->getUrl('newsletter/subscriber/unsubscribe', ['id' => $subscriber->getId(), 'code' => $subscriber->getCode(), '_nosid' => true]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:Data.php

示例7: getUrl

 /**
  * Get action url
  *
  * @param string $routePath
  * @param string $scope
  * @param string $store
  * @return string
  */
 public function getUrl($routePath, $scope, $store)
 {
     $this->frontendUrlBuilder->setScope($scope);
     $href = $this->frontendUrlBuilder->getUrl($routePath, ['_current' => false, '_query' => [StoreResolverInterface::PARAM_NAME => $store]]);
     return $href;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:UrlBuilder.php


注:本文中的Magento\Framework\UrlInterface::setScope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。