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 · 519 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 49 1 week ago
Plugins · by Xavier, 4 weeks ago
2 57 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1184 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 50 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 75 2 months ago