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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Admin pages button for own function

admin

Started by Christiana 5 years ago · 0 replies · 518 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 Rene, 1 week ago
2 46 1 week ago
Plugins · by Xavier, 4 weeks ago
2 55 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1181 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 49 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 73 2 months ago