Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Admin pages button for own function

admin

Started by Christiana 5 years ago · 0 replies · 635 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 complanar, 2 weeks ago
2 250 4 days ago
Plugins · by Vladimir Novak, 1 month ago
3 594 1 month ago
Plugins · by Mathieu Lecouturier, 2 months ago
3 417 2 months ago
Plugins · by Slebeig, 2 months ago
1 530 2 months ago
Plugins · by Rene, 3 months ago
2 731 3 months ago