On a Magento2 admin page (order/view) I added a form using phtml file with block. I would like to define my form action to my controller url : www.xxx.com/admin_toto/foo/bar/index
How can I generate this url ?
<form id="test" method="post" action="<?php echo ADMIN_URL.'foo/bar/index'?>">
<?php echo $block->getBlockHtml('formkey');?>
<input>...</input>
<span><button type="submit">Update</button></span>
</form>
1 Answer 1
try with
$block->getUrl('foo/bar/index');
answered Apr 7, 2017 at 15:02
Marius
199k55 gold badges431 silver badges837 bronze badges
default