[xwiki-devs] Inject Warning in Page when Macro in Space not exists
Hi All, i want to put a {{warning}} in the header of a page when a specific macro is not contained. How can i do that. I tried in a Listener when the needed Macro-Block is not contained with doc.getXDOM().getRoot().addChild(new WordBlock("{{warning}}Warning Text.{{/warning}}")); context.getWiki().saveDocument(doc, context); This not works. What is the correct way to manipulate the Document DOM on Load? Regards, Matthias -- View this message in context: http://xwiki.475771.n2.nabble.com/Inject-Warning-in-Page-when-Macro-in-Space... Sent from the XWiki- Dev mailing list archive at Nabble.com.
Hi Matthias, If you wish to modify the rendering of a document at runtime without changing its content you can: * Use a Sheet binding, see http://extensions.xwiki.org/xwiki/bin/view/Extension/Sheet+Module. That’ll allow to add stuff before and after the document’s content. That’s the simplest. * Use a Transformation, see http://rendering.xwiki.org/xwiki/bin/view/Main/Extending#HAddinganewTransfor... Thanks -Vincent On 16 Nov 2013 at 22:00:19, Matthias Wegner ([email protected](mailto:[email protected])) wrote:
Hi All,
i want to put a {{warning}} in the header of a page when a specific macro is not contained. How can i do that. I tried in a Listener when the needed Macro-Block is not contained with
doc.getXDOM().getRoot().addChild(new WordBlock("{{warning}}Warning Text.{{/warning}}")); context.getWiki().saveDocument(doc, context);
This not works. What is the correct way to manipulate the Document DOM on Load?
Regards, Matthias
participants (2)
-
Matthias Wegner -
vincent@massol.net