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