API Questions on Kentico API.
Version 6.x > API > Registering Custom Macros View modes: 
User avatar
Member
Member
CJB - 1/12/2012 6:03:09 AM
   
Registering Custom Macros
I have created and successfully registered a custom macro. I am using it to determine whether a WebPart should be displayed or not by using it in the ‘Visible’ property of the WebPart.

The macro appears in the autocompletion box and successfully hides or shows the WebPart

Is it possible to register the macro in such a way that in the autocompletion box it would appear as a method of a namespace?

e.g. If I create a macro called IsRegisteredInExternalSystem() within a namespace called MyExternalSystem I would like MyExternalSystem to appear in the autocompletion box and for IsRegisteredInExternalSystem() to be within that namespace.

Thanks
Craig Bennett

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 1/12/2012 7:27:11 AM
   
RE:Registering Custom Macros
Hi,

yes you can create a custom macro method. More details you can find here:
Custom macro method

The topic is also discussed in this thread:
http://devnet.kentico.com/Forums/f58/t24420/Registering-Custom-Macros.aspx

Best regards,
Ivana Tomanickova

User avatar
Member
Member
CJB - 1/12/2012 8:37:29 AM
   
RE:Registering Custom Macros
Ivana

Thanks for the reply.

I have already successfully created a custom macro, registered it and it is working from the 'Visible' property of the WebPart. So I don't have a problem with that.

What I wanted to do was to have a namespace appear within the autocompletion box and then you would be able to select custom macro within that namespace.

This would be similar to the way you can select 'CurrentUser' from the autocompletion box, type . and you see all of the properties of CurrentUser in the autocompletion box.

Thanks
Craig Bennett

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 1/17/2012 1:44:38 AM
   
RE:Registering Custom Macros
Hi,

actually, it should work this way. In the documentation is an example with:

CurrentUser.UserName - now if you type . , you should see MyMethod in auto-completion options. This method is visible only for string values. The second example shows the method only for DateTime values. So you can see what has to be changed. Is not it possible that you are using your method with boolean value? Then the definition of the method has to be different.

Best regards,
Ivana Tomanickova