Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
Best way to add a button to pagetools
Avatar
og #1
Member since May 2006 · 436 posts · Location: Bayern
Group memberships: Members
Show profile · Link to this post
Subject: Best way to add a button to pagetools
I want to add a custom button to the pagetools bar and do not want users using my plugin to manipulate main.php template files. What i came up with was to hook into "TEMPLATE_PAGETOOLS_DISPLAY_BEFORE" and manipulate the $event->data['items'] array if $event->data['view'] == 'main'. I then had to decide where to put my button into. Unfortunately the user can't really decide this in his template (main.php) or elsewhere, because it's hardcoded in my plugin code.

Does anyone can provide a better, smarten solution for this problem? How do you (plugin programmers) do it?
Oli...
Avatar
turnermm (Moderator) #2
Member since Oct 2009 · 4782 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
Can't really understand this but see: https://github.com/turnermm/dwedit
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
og #3
Member since May 2006 · 436 posts · Location: Bayern
Group memberships: Members
Show profile · Link to this post
Thanks Turner. What you've done there is nearly 100% equal to my solution described above :-)
Oli...
Avatar
turnermm (Moderator) #4
Member since Oct 2009 · 4782 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
My point was that you can create your own toolsevent Event, and place the link anywhere in the template:
   https://www.dokuwiki.org/plugin:ckgedit#page_tools_method

But maybe I misunderstood your question, since 'user' was ambiguous.  But if you mean an ordinary user, who is going to place this link or button at the browser level, then I think the only way to do this is to give your user a set of alternatives and place these toolsevents in your template, each with a different EVENT_NAME, and when the user chooses, save the choice in a cookie and enable the toolsevent matching the cookie.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-02-17, 22:37:17 (UTC +01:00)