Hi, I have two extensions (SelectCategoryTagCloud and FCKeditor) that both use the following hook to access the content of the edit page input box: $wgHooks['EditPage::showEditForm:initial']
How can I control which extension gets to do its work first?
I would like SelectCategoryTagCloud to strip out all existing category links in the wiki text (and consequently put it in the second input box for category assignment) and then have FCKeditor use the rest of the text to display in the wysiwyg editor. And when the user saves the page, I would like to reverse the order. First, FCKeditor stores the wikitext and then SelectCategoryTagCloud adds the categories selected by the user at the bottom of the wiki text. So the database always stores wiki text.
Any thoughts?
Thanks, Andi
Hooks are run in the order in which they're listed in the $wgHooks['whatever'] array.
The order you list your require_once() lines in your LocalSettings.php file is the easiest way to make something run first.
Alternatively, instead of:
$wgHooks['whatever'][] = 'myWhateverHook';
You could try this:
array_unshift( $wgHooks['whatever'], 'myWhateverHook' );
Which should put 'myWhateverHook' at the front of the list.
-- Jim R. Wilson (jimbojw)
On Feb 19, 2008 3:42 PM, Andreas Rindler mediawiki@jenandi.com wrote:
Hi, I have two extensions (SelectCategoryTagCloud and FCKeditor) that both use the following hook to access the content of the edit page input box: $wgHooks['EditPage::showEditForm:initial']
How can I control which extension gets to do its work first?
I would like SelectCategoryTagCloud to strip out all existing category links in the wiki text (and consequently put it in the second input box for category assignment) and then have FCKeditor use the rest of the text to display in the wysiwyg editor. And when the user saves the page, I would like to reverse the order. First, FCKeditor stores the wikitext and then SelectCategoryTagCloud adds the categories selected by the user at the bottom of the wiki text. So the database always stores wiki text.
Any thoughts?
Thanks, Andi
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Andreas Rindler schreef:
Hi, I have two extensions (SelectCategoryTagCloud and FCKeditor) that both use the following hook to access the content of the edit page input box: $wgHooks['EditPage::showEditForm:initial']
How can I control which extension gets to do its work first?
By require_once()ing one extension before the other. The extension require_once()'d first *generally* does its work first.
And when the user saves the page, I would like to reverse the order.
I'm afraid that's not possible unless you write a mediator extension that unregisters SCTC's and FCK's hook functions, registers itself with EditPage::showEditForm::initial instead and then decides in which order to run the hooks based on some EditPage property.
Roan Kattouw (Catrope)
You can also make a meta-extension (I just made that up) that calls the two other extensions in the order you want.
i.e. extension andiEdit.php:
<?php require_once ("what I want to load first"); require_once ("what I want to load second");
On Feb 19, 2008, at 5:18 PM, Jim Wilson wrote:
Hooks are run in the order in which they're listed in the $wgHooks['whatever'] array.
The order you list your require_once() lines in your LocalSettings.php file is the easiest way to make something run first.
Alternatively, instead of:
$wgHooks['whatever'][] = 'myWhateverHook';
You could try this:
array_unshift( $wgHooks['whatever'], 'myWhateverHook' );
Which should put 'myWhateverHook' at the front of the list.
-- Jim R. Wilson (jimbojw)
On Feb 19, 2008 3:42 PM, Andreas Rindler mediawiki@jenandi.com wrote:
Hi, I have two extensions (SelectCategoryTagCloud and FCKeditor) that both use the following hook to access the content of the edit page input box: $wgHooks['EditPage::showEditForm:initial']
How can I control which extension gets to do its work first?
I would like SelectCategoryTagCloud to strip out all existing category links in the wiki text (and consequently put it in the second input box for category assignment) and then have FCKeditor use the rest of the text to display in the wysiwyg editor. And when the user saves the page, I would like to reverse the order. First, FCKeditor stores the wikitext and then SelectCategoryTagCloud adds the categories selected by the user at the bottom of the wiki text. So the database always stores wiki text.
Any thoughts?
Thanks, Andi
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
Jim Hu schreef:
You can also make a meta-extension (I just made that up) that calls the two other extensions in the order you want.
i.e. extension andiEdit.php:
That won't work for his purposes: he wants the order to be different based on whether someone is saving or previewing.
Roan Kattouw (Catrope)
What I have seen so far is that the sequence of require_once doesn't matter, the fckeditor extension always gets the first shot. So I might have to either change the way SCTC parses out the category links from the fckeditor html (which it converts from wikitext on the fly) or hack fckeditor to not do anything with category links...
On 20/02/2008, Roan Kattouw roan.kattouw@home.nl wrote:
Jim Hu schreef:
You can also make a meta-extension (I just made that up) that calls the two other extensions in the order you want.
i.e. extension andiEdit.php:
That won't work for his purposes: he wants the order to be different based on whether someone is saving or previewing.
Roan Kattouw (Catrope)
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Yes, but it's relatively trivial to make the metaextension reverse the order based on action
On Feb 20, 2008, at 12:08 PM, Roan Kattouw wrote:
Jim Hu schreef:
You can also make a meta-extension (I just made that up) that calls the two other extensions in the order you want.
i.e. extension andiEdit.php:
That won't work for his purposes: he wants the order to be different based on whether someone is saving or previewing.
Roan Kattouw (Catrope)
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
wikitech-l@lists.wikimedia.org