Пример #1
0
 /**
  * Renders grid column
  *
  * @param   \Magento\Framework\Object $row
  * @return  string
  */
 public function render(\Magento\Framework\Object $row)
 {
     $readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' . __('Read Details') . '</a>' : '';
     $markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl('*/*/markAsRead/', array('_current' => true, 'id' => $row->getId())) . '">' . __('Mark as Read') . '</a>' : '';
     $encodedUrl = $this->_urlHelper->getEncodedUrl();
     return sprintf('%s%s<a class="action-delete" href="%s" onClick="deleteConfirm(\'%s\', this.href); return false;">%s</a>', $readDetailsHtml, $markAsReadHtml, $this->getUrl('*/*/remove/', array('_current' => true, 'id' => $row->getId(), \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $encodedUrl)), __('Are you sure?'), __('Remove'));
 }
Пример #2
0
 /**
  * Get item delete url
  *
  * @return string
  */
 public function getDeleteUrl()
 {
     if ($this->hasDeleteUrl()) {
         return $this->getData('delete_url');
     }
     $params = ['id' => $this->getItem()->getId()];
     if (!$this->_request->isAjax()) {
         $encodedUrl = $this->_urlHelper->getEncodedUrl();
         $params[\Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED] = $encodedUrl;
     }
     return $this->getUrl('checkout/cart/delete', $params);
 }
Пример #3
0
 /**
  * Prepare current URL for referer
  *
  * @return string
  */
 public function getUrlForReferer()
 {
     return \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED . '/' . $this->_urlHelper->getEncodedUrl();
 }
Пример #4
0
 public function testGetEncodedUrl()
 {
     $this->assertEquals('aHR0cDovL2xvY2FsaG9zdA,,', $this->_helper->getEncodedUrl());
     $this->assertEquals('aHR0cDovL2V4YW1wbGUuY29tLw,,', $this->_helper->getEncodedUrl('http://example.com/'));
 }