IPluginFormReplacer

Position of form variable evaluation plugins in Xima® Formcycle's program flow. They are run before form variables are processed by Xima® Formcycle.

Use cases

This type of plugin allows you to define new form variables or modify how existing variables are being evaluated. These plugins will be run before variables are processed by Xima® Formcycle.

You could also replace variables referring to form fields with a variable for a different field, which will then get evaluated by Xima® Formcycle as that form field's value.

Form variables have got the following syntax:

[%<formFieldName>%]

When multiple form variable evaluation plugins are installed, their order of execution is arbitrary. You should not rely on a certain fixed order.

Form variable evaluation plugins are run for all forms of the client they belong to, or for all existing forms when installed as a system plugin. We recommend you check whether the plugin should be executed for the current form, for example by defining a plugin property containing a list of allowed forms.

Method signature

IPluginFormReplacerRetVal replace(IPluginFormReplacerParams params) throws FCPluginException

Parameters

An object of type IPluginFormReplacerParams is passed to the execute method, providing access to the following properties:

  • The entire variable string, including its syntax, eg. [%tf1%}. (getPlaceholder())
  • The variable name, without its syntax, eg. tf1. (getPlaceholderContent())
  • The current form version. (getFormversion())
  • The form data adapter, providing access to form data. (getFormDataAdapter())
  • Boolean flag controlling whether the return value must be valid HTML. (isEncodeForHTML())
  • Current user context for accessing the databases. (getEntityContext())

Return value

The execute method must return an object implementing IPluginFormReplacerRetVal.

The class PluginGenericReplacerRetVal provides a reference implementation. Its constructor takes the string containing the evaluated value of the variable.

Tags:
Copyright 2000-2024