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]));
 }
 /**
  * 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);
 }
 /**
  * @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];
 }
Example #4
0
 /**
  * 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);
 }
 /**
  * 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);
 }