Admin pages button for own function

can anybody help me to find out what is the best way in admin panel (->pages) to call an own function via button? Can I only use Event Hooks ?

Is it the right way to add an button to pages.html.twig in an own plugin like

<button name="task" value="doMyMethod" form="blueprints" type="submit" class="button"> Title </button>

And than call the function in

public function onAdminTaskExecute($event) {
         if($event["method"] == 'doMyMethod' ){
                  //call my method here...