本文整理汇总了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]);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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]);
}
示例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;
}