Adding Custom Back-end Actions
The task for the custom action is defined as compound tasks - the first part is the controller and the second part is the name of the method.
Step 1: View File
src/View/Planets/HtmlView.php
You can add the custom toolbar button in the view file as follows:
ToolbarHelper::custom('planets.custom', 'ok', 'ok', 'Custom Button', false);
On clicking the button, Joomla will look for the custom() method in the controller file: src/Controller/PlanetsController.php
Step 2: Controller File
src/Controller/PlanetsController.php
Define the custom() method here. Generally, this method gets the data or information from either the GET request or POST request or both. Then, it gets the model and passes the data to the required method of the model. Finally, it sets a message and a redirect.