Hi i'm new at magento2 and i want to put a PHP function in an "on click" attribute of a button on ui component form.
Specifically on this "Save Header" button.
So, actually i want to use this "Save Header" button to just save two fields of the form, the fields (Nome Header, Valor Header).
The "on click" attribute. In this "on click" i want to call a php function...
routes.xml:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="admin">
<route id="api" frontName="api">
<module name="Hub_Api" />
</route>
</router>
------------------------------EDIT---------------------------------
So now my "SaveHeader" button is like that, but still don't working, maybe the url is passed wrong:
SaveHeader.php (Controller):
namespace Hub\Api\Controller\Adminhtml\Data;
class SaveHeader extends \Magento\Framework\App\Action\Action { protected $logger;
public function __construct(
\Psr\Log\LoggerInterface $logger
) {
$this->logger = $logger;
parent::__construct();
}
/**
* View page action
*
* @return void
*/
public function execute()
{
$txt = 'HUDSON SAVEHEADER : ';
$this->logger->log('DEBUG', $txt);
}
}
Save Header
button controller path set this type magento.stackexchange.com/a/274310/85907