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


PHP UrlInterface::getCurrentUrl方法代码示例

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


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

示例1: build

 /**
  * @return $this
  */
 public function build()
 {
     if (!$this->isVisible()) {
         return parent::_prepareLayout();
     }
     $this->buildMenu();
     $currentUrl = $this->urlBuilder->getCurrentUrl();
     /** @var DataObject $item */
     foreach ($this->getFlatTree() as $item) {
         if (!is_object($item)) {
             continue;
         }
         if ($item->getData('url') == $currentUrl) {
             $this->activeItem = $item;
             break;
         }
     }
     return parent::_prepareLayout();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:22,代码来源:AbstractMenu.php

示例2: _setupCollection

 /**
  * @param $entity_ids
  */
 protected function _setupCollection($entity_ids)
 {
     $list = $this->_objectManager->create('\\Boxalino\\Intelligence\\Model\\Collection');
     $list->setStoreId($this->_storeManager->getStore()->getId())->addFieldToFilter('entity_id', $entity_ids)->addAttributeToSelect('*');
     $list->getSelect()->order(new \Zend_Db_Expr('FIELD(e.entity_id,' . implode(',', $entity_ids) . ')'));
     $list->load();
     $list->setCurBxPage($this->getToolbarBlock()->getCurrentPage());
     $limit = $this->getRequest()->getParam('product_list_limit') ? $this->getRequest()->getParam('product_list_limit') : $this->getToolbarBlock()->getDefaultPerPageValue();
     $totalHitCount = $this->p13nHelper->getTotalHitCount();
     if (ceil($totalHitCount / $limit) < $list->getCurPage() && $this->getRequest()->getParam('p')) {
         $url = $this->_url->getCurrentUrl();
         $url = preg_replace('/(\\&|\\?)p=+(\\d|\\z)/', '$1p=1', $url);
         $this->_response->setRedirect($url);
     }
     $lastPage = ceil($totalHitCount / $limit);
     $list->setLastBxPage($lastPage);
     $list->setBxTotal($totalHitCount);
     $this->_productCollection = $list;
 }
开发者ID:boxalino,项目名称:plugin-magento2,代码行数:22,代码来源:BxListProducts.php

示例3: getOptionalContext

 /**
  * Get context values that may not be available and are not required
  * for every log call. Only available values will be included in this
  * set of context values.
  *
  * @return array
  */
 protected function getOptionalContext()
 {
     return array_filter([self::APP_REQUEST_URL => $this->url->getCurrentUrl(), self::SESSION_ID => $this->getSafeSessionId()]);
 }
开发者ID:eBayEnterprise,项目名称:magento2-retail-order-management,代码行数:11,代码来源:LoggerContext.php

示例4: getDomain

 /**
  * Backend domain
  *
  * @return string
  */
 public function getDomain()
 {
     return $this->urlManager->getCurrentUrl();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:9,代码来源:License.php


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