Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Admin pages button for own function

admin

Started by Christiana 5 years ago · 0 replies · 676 views
5 years ago

Hi,
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

PHP
public function onAdminTaskExecute($event) {

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

}
last edited 04/21/21 by Christiana

Suggested topics

Topic Participants Replies Views Activity
Plugins · by renedebaaij, 2 days ago
0 42 2 days ago
Plugins · by complanar, 3 weeks ago
6 394 2 weeks ago
Plugins · by BenLaKnet, 2 weeks ago
1 211 2 weeks ago
Plugins · by complanar, 1 month ago
2 486 1 month ago
Plugins · by Vladimir Novak, 2 months ago
3 765 2 months ago