Skip to content
Grav 2.0 is officially stable. Read the announcement →
Plugins

Admin pages button for own function

admin

Started by Christiana 5 years ago · 0 replies · 584 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 Mathieu Lecouturier, 6 days ago
3 132 3 days ago
Plugins · by Slebeig, 4 weeks ago
1 296 4 weeks ago
Plugins · by Rene, 2 months ago
2 456 2 months ago
Plugins · by Xavier, 2 months ago
2 373 2 months ago
Plugins · by Luka Prinčič, 7 years ago
3 1597 3 months ago