Hello, I see that for the 1.16 release many hooks were added in EditPage.php. First of all, I would like to thank the developers for making my job much easier: in the past I had to override entire methods of EditPage to implement the visual editor.
I would like to get rid of all the messy stuff and use the new "clean" hooks, but I'm still having some issues:
1) I use the EditPageBeforeEditChecks hook to add a checkbox to disable MeanEditor. However, I also need to set it to the correct value. Right now, I am overriding the entire showStandardInputs function just to change line 1749 (referring to http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_16/phase3/includes/E...). Am I missing an obvious solution here?
2) I would like to disable the default toolbar when the visual editor is in use. In the past, I used to override the entire showEditForm method and reset the $toolbar variable. How can I accomplish this now?
3) I need to add the 'wymupdate' class to the standard buttons (submit, preview, diff, etc.). Is there a clean way to do this without overriding the entire getEditButtons method?
Thanks in advance for answers -- Jacopo Corbetta
Jacopo Corbetta wrote:
- I need to add the 'wymupdate' class to the standard buttons
(submit, preview, diff, etc.). Is there a clean way to do this without overriding the entire getEditButtons method?
Why do you need to do so? input.editButtons selector should be enough...
Jacopo Corbetta wrote:
Hello, I see that for the 1.16 release many hooks were added in EditPage.php. First of all, I would like to thank the developers for making my job much easier: in the past I had to override entire methods of EditPage to implement the visual editor.
That's probably my work refactoring EditPage to be better extensible.
^_^ Thank the people who cleaned up after me instead of undoing the feature too, I break trunk somehow whenever I commit to core even when I test.
I would like to get rid of all the messy stuff and use the new "clean" hooks, but I'm still having some issues:
- I use the EditPageBeforeEditChecks hook to add a checkbox to
disable MeanEditor. However, I also need to set it to the correct value. Right now, I am overriding the entire showStandardInputs function just to change line 1749 (referring to http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_16/phase3/includes/E...). Am I missing an obvious solution here?
You talking about the $checked values passed by showStandardInputs? I think that was probably just there for legacy or to cleanly separate values from that method, I can't remember. But all getCheckboxes uses that for is passing booleans, can't you just supply the checkbox value directly in your hook?
- I would like to disable the default toolbar when the visual editor
is in use. In the past, I used to override the entire showEditForm method and reset the $toolbar variable. How can I accomplish this now?
Ouch, it would have been nicer for you if getEditToolbar was not static. And perhaps also if the two "should I show the toolbar" tests were broken into another instance method. I think you might be able to use EditPageBeforeEditToolbar to erase the toolbar though.
- I need to add the 'wymupdate' class to the standard buttons
(submit, preview, diff, etc.). Is there a clean way to do this without overriding the entire getEditButtons method?
Hmm, that makes me think getEditButtons would have been better to use an assoc-array where the contents were arguments to Xml::element so it could be overridden instead of straight html. I can't think of a non-ugly way to do this. You could almost override getEditButtons, call the superclass method, and for each input use a regex to insert a class manually... though that IS ugly.
Thanks in advance for answers -- Jacopo Corbetta
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
On Thu, Aug 5, 2010 at 07:04, Daniel Friesen lists@nadir-seen-fire.com wrote:
- I use the EditPageBeforeEditChecks hook to add a checkbox to
disable MeanEditor. However, I also need to set it to the correct value. Right now, I am overriding the entire showStandardInputs function just to change line 1749 (referring to http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_16/phase3/includes/E...). Am I missing an obvious solution here?
You talking about the $checked values passed by showStandardInputs? I think that was probably just there for legacy or to cleanly separate values from that method, I can't remember. But all getCheckboxes uses that for is passing booleans, can't you just supply the checkbox value directly in your hook?
Yes, it works. I was trying to replicate the functionality of the minoredit checkbox (read from preference the first time, keeps the user-selected value after that), so I was only looking at that. I now set the initial value during importFormData, that's probably the right place to do so.
- I would like to disable the default toolbar when the visual editor
is in use. In the past, I used to override the entire showEditForm method and reset the $toolbar variable. How can I accomplish this now?
Ouch, it would have been nicer for you if getEditToolbar was not static. And perhaps also if the two "should I show the toolbar" tests were broken into another instance method. I think you might be able to use EditPageBeforeEditToolbar to erase the toolbar though.
It works, thanks for the suggestion.
- I need to add the 'wymupdate' class to the standard buttons
(submit, preview, diff, etc.). Is there a clean way to do this without overriding the entire getEditButtons method?
Hmm, that makes me think getEditButtons would have been better to use an assoc-array where the contents were arguments to Xml::element so it could be overridden instead of straight html. I can't think of a non-ugly way to do this. You could almost override getEditButtons, call the superclass method, and for each input use a regex to insert a class manually... though that IS ugly.
Well, for now I will just replicate the method, it's quite short and the modification is easy. @Platonides: the ".wymupdate" selector is hardcoded into WYMeditor. I prefer to leave WYMeditor untouched, so that I/users can use another version, custom plugins, etc.
Thanks for your answers -- Jacopo
wikitech-l@lists.wikimedia.org