I am trying to create afterSave plugin for my admin form save action controller of my custom module. The purpose of this is to save some data into second table once all data completely save in first table.
Here is my di.xml file code :
<type name="Namespace\Module\Controller\Adminhtml\Options\Save">
<plugin name="save_option_label" type="Namespace\Module\Plugin\OptionlabelSave" sortOrder="1" />
</type>
I have also created OptionlabelSave.php file inside \Plugin\ directory.
Here is the code :
<?php
namespace Namespace\Module\Plugin;
/**
* Class OptionlabelSave
* @package Namespace\Module\Plugin
*/
class OptionlabelSave
{
public function afterSave(Namespace\Module\Controller\Adminhtml\Options\Save $subject, $result) {
echo 'test save'; exit;
return $result;
}
}
However, when I click on save button in admin edit form I am not getting 'test save' printed on my screen. Am I missing anything here?
Please help. That would be highly appreciated.
Thanks,