DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

String

This is a lot like calculate - it allows to manipulate a string. Possible as outwards callback and as action on getFormValidation for live string updates.

aStep

Array. All the string manipulation steps sorted by its key. Every step is another array containing an operator (eOperator) and a value (sValue) and is applied to the foregoing string. For easier understanding consider the following example:

'aStep' => array(
            '20' => array(
                    'sValue' => ':',
                    'eOperator' => 'explode-0/1'
            ),
            '10' => array(
                    'sValue' => '###subject###'
            ),
            '30' => array(
                'sValue' => ',',
                'eOperator' => 'remove'
            ),
            '40' => array(
                'eOperator' => 'trim'
            )
    )

First of all, the steps (the chain, so to say) are ordered by its keys - thus the new order is 10 (subject), 20 (explode), 30 (remove) and finally 40 (trim). To start with 10, no operator is defined which means the default operator (set) is applied. The subject originally looks like "Web Contact from: Canada, Toronto", where it starts with this string (see step 10) and every following step takes the last result as starting point. So the chain would -- in this case -- look like the following:

  • take subject
  • split it at : and take the second (0/1) part
  • remove ,
  • trim trailing spaces

Hence, the result looks like:

Canada Toronto

As you can see, sValue may either be a direct value (like 3), a column/field name marker (###subject###) or even a marker for the well-known things (like ###GP:id###, ###tstamp###, ###date:Y### or ###fe_user:uid###). The operator on the other hand might be one of the following (note that sValue tells you what mValue in this case needs to be):

Operator Function sValue Example
set = new string "new string"
trim remove start/end   " bla " = "bla"
remove remove character char. to remove "foo, bar" = "foo bar"
attach append string string to attach "foo" + "bar" = "foobar"
substr sub string 0:4 (position, length) "www.foo.bar" = "www."
substr sub string 4 (starting position) "www.foo.bar" = "foo.bar"
substr sub string -3 (neg. start. pos.) "www.foo.bar" = "bar"
explode-0/1 split, use pt. 2 split character "foo:bar" split at ":" = "bar"
explode-1/0 split, use pt. 1 split character "foo:bar" split at ":" = "foo"
replace replace part find:replace "foo@bar" replace "@:--" = "foo--bar.com"

In case you don't understand all the parts, see the corresponding PHP functions at php.net:

  • set: ... = sValue
  • trim: trim(...)
  • remove: str_replace(sValue, '', ...)
  • attach: ... .= sValue
  • substr with x:y: ... = substr(..., x, y)
  • substr with x: ... = substr(..., x)
  • substr with -x: ... = substr(..., -x)
  • explode-0/1: list(, ...) = explode(sValue, ..., 2)
  • explode-1/0: list(..., ) = explode(sValue, ..., 2)
  • replace with x:y: ... = str_replace(x, y, ...)

bDontForce

Boolean. Allows the user to manually set the value on creation and thus prevent this callback handler from calculating. If set to true, the calculation is done only if the currently entered value is 0, empty, NULL or false.