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


PHP AbstractBlock::getUrl方法代码示例

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


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

示例1: testGetUrl

 public function testGetUrl()
 {
     $base = 'http://localhost/index.php/';
     $withRoute = "{$base}catalog/product/view/id/10/";
     $this->assertEquals($base, $this->_block->getUrl());
     $this->assertEquals($withRoute, $this->_block->getUrl('catalog/product/view', ['id' => 10]));
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:7,代码来源:AbstractBlockTest.php

示例2: _wrapEsi

 /**
  * Replace the output of the block, containing ttl attribute, with ESI tag
  *
  * @param \Magento\Framework\View\Element\AbstractBlock $block
  * @param \Magento\Framework\View\Layout $layout
  * @return string
  */
 protected function _wrapEsi(\Magento\Framework\View\Element\AbstractBlock $block, \Magento\Framework\View\Layout $layout)
 {
     $url = $block->getUrl('page_cache/block/esi', ['blocks' => json_encode([$block->getNameInLayout()]), 'handles' => json_encode($layout->getUpdate()->getHandles())]);
     // Varnish does not support ESI over HTTPS must change to HTTP
     $url = substr($url, 0, 5) === 'https' ? 'http' . substr($url, 5) : $url;
     return sprintf('<esi:include src="%s" />', $url);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:ProcessLayoutRenderElement.php

示例3: beforePushButtons

 /**
  * @param ToolbarContext $toolbar
  * @param AbstractBlock $context
  * @param ButtonList $buttonList
  * @return array
  */
 public function beforePushButtons(ToolbarContext $toolbar, \Magento\Framework\View\Element\AbstractBlock $context, \Magento\Backend\Block\Widget\Button\ButtonList $buttonList)
 {
     if (!$context instanceof \Magento\Sales\Block\Adminhtml\Order\View) {
         return [$context, $buttonList];
     }
     $buttonList->update('order_edit', 'class', 'edit');
     $buttonList->update('order_invoice', 'class', 'invoice primary');
     $buttonList->update('order_invoice', 'sort_order', (count($buttonList->getItems()) + 1) * 10);
     $buttonList->add('order_review', ['label' => __('Review'), 'onclick' => 'setLocation(\'' . $context->getUrl('sales/*/review') . '\')', 'class' => 'review']);
     $buttonList->remove('order_hold');
     $buttonList->remove('send_notification');
     return [$context, $buttonList];
 }
开发者ID:mcspronko,项目名称:magento2-order-buttons,代码行数:19,代码来源:Toolbar.php

示例4: _wrapEsi

 /**
  * Replace the output of the block, containing ttl attribute, with ESI tag
  *
  * @param \Magento\Framework\View\Element\AbstractBlock $block
  * @return string
  */
 protected function _wrapEsi(\Magento\Framework\View\Element\AbstractBlock $block)
 {
     $url = $block->getUrl('page_cache/block/esi', array('blocks' => json_encode(array($block->getNameInLayout())), 'handles' => json_encode($this->_helper->getActualHandles())));
     return sprintf('<esi:include src="%s" />', $url);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:Observer.php

示例5: _wrapEsi

 /**
  * Replace the output of the block, containing ttl attribute, with ESI tag
  *
  * @param \Magento\Framework\View\Element\AbstractBlock $block
  * @param \Magento\Framework\View\Layout $layout
  * @return string
  */
 protected function _wrapEsi(\Magento\Framework\View\Element\AbstractBlock $block, \Magento\Framework\View\Layout $layout)
 {
     $url = $block->getUrl('page_cache/block/esi', ['blocks' => json_encode([$block->getNameInLayout()]), 'handles' => json_encode($layout->getUpdate()->getHandles())]);
     return sprintf('<esi:include src="%s" />', $url);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:12,代码来源:ProcessLayoutRenderElement.php


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