You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
There is the following xthml-macro:
<xhtml-macro name="pinkbutton" class="ro.fortech.att.confluence.macro.PinkButtonMacro" key='pinkbutton'>
<description>PinkButton</description>
<category name="confluence-content"/>
<parameters>
<parameter name="label" required="true" type="string"/>
<parameter name="link" type="string" required="true"/>
</parameters>
</xhtml-macro>
And also the following class:
public class PinkButtonMacro extends FortechBaseMacro {
private static final String MACRO_BODY_TEMPLATE = "components/pinkbutton.vm";
@RequiresFormat(Format.View)
public String execute(Map<String, String> params, String body, ConversionContext conversionContext) throws MacroExecutionException {
Map<String, Object> context = MacroUtils.defaultVelocityContext();
putParamIfExists_EmptyTextIfNot(params, context, "label");
putParamIfExists_EmptyTextIfNot(params, context, "link");
return VelocityUtils.getRenderedTemplate(MACRO_BODY_TEMPLATE, context);
}
What I want is to replace the parameter name "label" to "Button label" and "link" to "Button link". The problem occures in the `execute` method because of the params.
Is there a way to get the params if there is a space character in the xhtml-macro parameter name?
As far as I know, parameters cannot have spaces. Most of the time dashes are used instead, so button-label and button-link. If you want a different name to appear in the editor window, then you'll need to include it in the .properties file. See the example here for more details:
Hi, the link is no longer working. Could you explain how I can accomplish this? Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.