Custom object property
Description
Customer object property is a property of a object or block that is user defined. This will help the developer to add options and settings
for the template user.
YourCustomPrperty the name of the property can be anything the developer wants. One can have as many custom properties as needed, however
they cannot have the same name. Custom properties can be added to ANY objects and blocks.
TheObjectName and TheBlockName are used here as an example, they should be the names of actual objects and blockes from the template.
To note that inside the list items blocks, the custom property does not hold the value for all the items, it will render the same value for all the list items.
{object:TheObjectName}
{:YourCustomPrperty
isCustom='true'
name='Background image'
description='Description of property'
isExternalEdit='true'
isTextEditable='true'
type='image'
imageSize="L"
defaultValue='path/to/image.jpg'}
{/object:TheObjectName}
-- OR --
{object:TheObjectName}
{block:TheBlockName}
{:YourCustomPrperty
isCustom='true'
name='Background image'
description='Description of property'
isExternalEdit='true'
isTextEditable='true'
type='image'
imageSize="S"
imageGroupName="group1"
defaultValue='path/to/image.jpg'}
{/block:TheBlockName}
{/object:TheObjectName}
Attributes
isCustom- is indicating that this is developer defined propertytypeVideo- the user will be able to enter an url of the videoImage- the user will be able to select an image from storage accountNumber- a field that will be transformed into a numberText- a field that the user can enter text.String- same asText, but is non html textUrl- user can enter an urlSelect- user is presented with different options to choose from
imageSize- only fortype="image", a flag for the image size, possible values:SorLimageGroupName- only fortype="image", it's grouping images with different properties to use only one image valueisAttribute[deprecated] - useisExternalEditisExternalEdit- is indicating if the property is rendered as an html element attribute, setting this totruewill also setisTextEditabletofalseisTextEditable- if the field can be editable by the user in the website editor, this transforming the property into an editor, if the property is rendered as an html attribute, you want to set this to false, also settingisExternalEditto true will have the same efect the difference is that inisExternalEdityou can edit the value in a sidebar and not in page.disableRichTextEditor- is disabling rich text editing of the fieldoptions- only used withtype='select'to show choices for user to selectgroup- it's grouping properties into a single UI block for the user to see that the properties are dependent on each otherdefaultValue- default valued if the user does not change itname- the name displayed in the oprions window that user will seedescription- descriptions that user will see in the options window, usually an explanation of what the property is doing
How type="select" works
This will be rendered on the user options as an select dropdown for user to select one of the options. In webpage the property will be rendered
only the option value, such as value1 or value2 or value3.
{:YourSelectProperty
isCustom='true'
name='Select from following'
description='Description of property'
isExternalEdit='true'
type='select'
options="value1=This is value 1,value2=This is value 2,value3=This is value 3"
defaultValue='value1'}
How and when to group properties
The best case to group properties is for type="url". Consider the following example:
<a
href="{:YourUrl
isCustom='true'
name='Url'
description='Url to navigate'
isExternalEdit='true'
type='url'
group="group1"
defaultValue='javascript:void(0)'}"
target="{:YourUrlTarget
isCustom='true'
name='Target'
description='Url target'
isExternalEdit='true'
type='select'
group="group1"
options="_blank=Opens the linked document in a new window or tab,_self=Opens the linked document in the same window as it was clicked"
defaultValue='_blank'}">
Read more
</a>
If you want for the user to see the url as text as well
<a
href="{:YourUrl
isCustom='true'
name='Url'
description='Url to navigate'
isExternalEdit='true'
type='url'
group="group1"
defaultValue='javascript:void(0)'}"
target="{:YourUrlTarget
isCustom='true'
name='Target'
description='Url target'
isExternalEdit='true'
type='select'
group="group1"
options="_blank=Opens the linked document in a new window or tab,_self=Opens the linked document in the same window as it was clicked"
defaultValue='_blank'}">
{:YourUrl}
</a>
Issues with type='image' that have imageSize="S" or imageSize="L" attributes
The main issue with images with different sizes is that they replace each other's value. If you have {:Image1 ... type='image' imageSize="S" }
and {:Image1 ... type='image' imageSize="L" } properties in the same object, note the Image1 property name and different imageSize attribute
alues, the value will be replaced by last property used in your code. To get arround this issue you can add imageGroupName attribute to
group your images and change the property names.
{object:TheObjectName}
{block:TheBlockName}
{:YourCustomPrpertyS
isCustom='true'
name='Background image'
description='Description of property'
type='image'
imageSize="S"
imageGroupName="group1"
defaultValue='path/to/image.jpg'}
{:YourCustomPrpertyL
isCustom='true'
name='Background image'
description='Description of property'
type='image'
imageSize="L"
imageGroupName="group1"
defaultValue='path/to/image.jpg'}
{/block:TheBlockName}
{/object:TheObjectName}
Please note the different property name in above example: YourCustomPrpertyS and YourCustomPrpertyL, also note that both properties have
the same group imageGroupName="group1", this means that when the user will change the image, the same image will be used on both properties,
but with different sizes.
Tracking images data across modules (widgets)
Transfering data from one widget to another can be an issue with custom properties. There are two ways to transfer data.
- through
imageGroupName, maintaining the same group name we can find these properties and set the thier values from previous widgets. - property name, you can keep the same property name from widget to widget - this can be problematic since
YourCustomPrpertySmight mean that the image is small and it can create confusion, to avoid that use the first technique.
Consider the following widgets:
{object:Widget id="test1"}
{:YourCustomPrpertyS
isCustom='true'
name='Background image'
description='Description of property'
type='image'
imageSize="S"
imageGroupName="group1"
defaultValue='path/to/image.jpg'}
{:YourCustomPrpertyL
isCustom='true'
name='Background image'
description='Description of property'
type='image'
imageSize="L"
imageGroupName="group1"
defaultValue='path/to/image.jpg'}
{/object:Widget}
{object:Widget id="test2"}
{:SomeOtherCustomPrpertyS
isCustom='true'
name='Background image'
description='Description of property'
type='image'
imageSize="S"
imageGroupName="group1"
defaultValue='path/to/image.jpg'}
{:SomeOtherCustomPrpertyL
isCustom='true'
name='Background image'
description='Description of property'
type='image'
imageSize="L"
imageGroupName="group1"
defaultValue='path/to/image.jpg'}
{/object:Widget}
{object:Widget id="test3"}
{:SomeOtherCustomPrpertyS
isCustom='true'
name='Background image'
description='Description of property'
type='image'
imageSize="S"
defaultValue='path/to/image.jpg'}
{/object:Widget}
Transferring data from test1 to test2
The value of YourCustomPrpertyS or YourCustomPrpertyL will be transferred to SomeOtherCustomPrpertyS and SomeOtherCustomPrpertyL through
the use of imageGroupName="group1".
Transferring data from test2 to test3
The value of SomeOtherCustomPrpertyS in test2 will be transferred to SomeOtherCustomPrpertyS in test3, note
that SomeOtherCustomPrpertyS in test2 does not have imageGroupName set, the transfer will be done through property name.
Example of isExternalEdit ussage
The following example will set the value of the :BackgroundImg as the value of the test attribute. It is important to set this
isExternalEdit value correctly, otherwise the rendering will result in incorrect html code.
<div
class="background-image-holder"
test="{:BackgroundImg
isCustom='true'
name='Background image'
description='Set new background image for this block - custom property'
isExternalEdit='true'
type='image'
defaultValue='images/hero16.jpg'}">
<img alt="image" src="{:ImageL}">
</div>