So as you already understand I want to create Save & Continue Edit button with ui components. Here is my ui components file:
<item name="buttons" xsi:type="array">
<item name="back" xsi:type="string">Vendor\ProductComments\Block\Adminhtml\Comment\Edit\BackButton</item>
<item name="saveAndContinueEdit" xsi:type="string">Vendor\ProductComments\Block\Adminhtml\Comment\Edit\SaveAndContinueButton</item>
<item name="save" xsi:type="string">Vendor\ProductComments\Block\Adminhtml\Comment\Edit\SaveButton</item>
<item name="delete" xsi:type="string">Vendor\ProductComments\Block\Adminhtml\Comment\Edit\DeleteButton</item>
</item>
SaveAndContinueButton.php:
<?php
namespace Vendor\ProductComments\Block\Adminhtml\Comment\Edit;
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
class SaveAndContinueButton extends GenericButton implements ButtonProviderInterface
{
/**
* @return array
*/
public function getButtonData()
{
return [
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => [
'mage-init' => ['button' => ['event' => 'save']],
'form-role' => 'save',
],
'sort_order' => 80,
];
}
}
My save button is working correctly, but when I press save and continue button, it just goes to admin index page. Also I haven't yet decided how to do that so it stays on edit page, but first I need to fix it so it uses Save.php controller. For save button i did this:
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="*/*/save"/>
</item>
Do i need to do something like this also for save and continue button?