0

I have the below code for a Action column option:

$item[$name]['view'] = [
    'href' => 'www.google.co.uk',
    'target' => '_blank'
    ),
    'label' => __('View')
];

What I'm trying to do is add an external URL to an action column such as google.co.uk. It should open a new tab and displays Google's home page.

Currently, the code provided appends www.google.co.uk to the Magento page URL.

Could you please let me know where I'm going wrong?

Thank you.

1
  • 1
    Try with full URL, so add the "http://" in url Commented Jul 2, 2018 at 13:27

1 Answer 1

0

Try this one

$item[$name]['view'] = [
   'href' => $this->urlBuilder->getUrl('http://www.google.co.uk'),
   'target' => '_blank'
  ),
 'label' => __('View')
];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.