Skip to main content

Tab Custom Rules

One of the great additional features of Exposer are the Custom Rules for custom fields. Custom rules allow you to edit the contents of custom fields before they are displayed. You can output text before or after custom field values, or modify the formatting of dates. The rules can be configured per custom field and layout-based.
Field Description
Field Contents to be skipped If one of the values of this comma separated list is found in a custom field, the field is not displayed. This prevents empty fields or fields with a NULL value from being displayed in the frontend.
Skip empty Fields General function that prevents empty fields from being displayed in the frontend. Fields without values are not displayed in the frontend if this option is activated.
Add Rule A new rule can be added using the Plus button. There is no limit in the number of rules. Rules are applied one after the other. Available rules are:
  • before (inserts a custom text for the value of the corresponding field)
  • after (inserts a custom text after the value of the corresponding field)
  • replace (replaces field values with the characters specified in the form)
  • date format (formats a date specification of a custom field into another format)
Add Rule > Customfield Name Name of the custom field to which this rule applies
Add Rule > Rule Type The applicable rule. Available rules are:
  • before (inserts a custom text for the value of the corresponding field)
  • after (inserts a custom text after the value of the corresponding field)
  • replace (replaces field values with the characters specified in the form)
  • date format (formats a date specification of a custom field into another format)
String to Add Only available when Rule Type Before or After is selected
The string to be added

Example:
Customfield Value = 21
Rule Type = before
String to Add = #
Frontend Display: #21
String to Search Only available when Rule Type Replace is selected
The string to be replaced can be one or more words.
Replacement Type Only available when Rule Type Replace is selected
Type of replacement, this replaces the string to search, can be a string or a linebreak.
Replacement Only available when Rule Type Replace is selected und Replacement Type is String
The string to be inserted
Rule Target This option controls for which layout this rule should be applied.

Some examples of rule usage

Customfield Name: my-customfield
Customfield Value: This_is_my_Field_Value

Replace

Underscores should be replaced by line breaks

Underscores should be replaced by Linebreaks so in the Frontend the Field will be rendered like this:
This<br>is<br>my<br>Field<br>Value

This
is
my
Field
Value

Before / After

Information should be output before or after the field value

Mode: before
String: #
Result: #This_is_my_Field_Value

Mode: after
String:  lets move on
Result: This_is_my_Field_Value lets move on

Multiple Rules

Replace all Underscores with Whitespaces and insert a line break for each _%br%_

Fieldvalue for this example: This_is_my_Field_Value_%br%_lets_move_on_%br%_and_go

Keep in mind: The custom rules are processed one after the other, so if we first replace all underscores with spaces we won't have the expected information for the linebreak - an example of how it wouldn't work:

crules false

This example above shows a rule sequence that does not lead to the desired result.

As a result all underscores are replaced by spaces in the first pass, which means that after the first pass the string of the custom field looks like this:
This is my Field Value %br% lets move on %br% and go

As you can see our second rule would not work anymore because there is no element with the string _%br%_ in the string. The solution is that we must first use the rule with the line break and only then we can substitute the underscores with spaces.