Wiki source code of Platzhalterersetzung (Templates)
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{content/}} | ||
2 | |||
3 | == Interface IPluginTemplateReplacer == | ||
4 | |||
5 | === Uses === | ||
6 | |||
7 | {{figure image="plugin_platzhalterersetzung_template_en.png" width="400" clear="h3"}} | ||
8 | Placement of the placeholder replacement plugin for //templates// in the process chain of {{formcycle case="dat"/}} | ||
9 | {{/figure}} | ||
10 | |||
11 | An implementation of the //IPluginTemplateReplacer// interface allows to integrate own replacement logic for the replacement process of template placeholders. //Templates// can be defined under the menu item [[Files & Templates>>doc:Formcycle.UserInterface.FilesAndTemplates.WebHome]] for the types //HTML//, //Text//, //E-Mail// and //Link //. | ||
12 | |||
13 | The own implementations are thereby carried out before the internal placeholder setting process of {{formcycle case="dat"/}}. | ||
14 | |||
15 | The [[placeholder replacement>>doc:Formcycle.UserInterface.Variables]] will look for the following pattern and replace it with the corresponding //Template//: | ||
16 | |||
17 | {{code language="none"}} | ||
18 | [%$$<own placeholder identifier or name of a template>%] | ||
19 | {{/code}} | ||
20 | |||
21 | {{warning}} | ||
22 | When using multiple //IPluginTemplateReplacer// implementations, their execution order is not fixed. This may lead to different results when executed multiple times. | ||
23 | {{/warning}} | ||
24 | |||
25 | {{warning}} | ||
26 | The //IPluginTemplateReplacer// implementations are basically executed for each form processing in the respective application area (system or client plug-in) in which they were installed. It is therefore recommended to first check in the implementation logic whether the //IPluginTemplateReplacer// should be executed for the respective form processing. This can be configured, for example, using [[Plugin-Properties>>doc:Formcycle.PluginDevelopment.BundleProperties]]. | ||
27 | {{/warning}} | ||
28 | |||
29 | === Method signatures === | ||
30 | |||
31 | The plugin interface //IPluginTemplateReplacer// references all methods provided by the [[base interface IFCPlugin>>doc:IFCPlugin]] | ||
32 | and additionally the following plugin-specific method signatures: | ||
33 | |||
34 | {{panel title="{{code language='java'~}~}IPluginTemplateReplacerRetVal replace(IPluginTemplateReplacerParams params) throws FCPluginException{{/code~}~}" triggerable="true" fullwidth="true"}} | ||
35 | |||
36 | **Transfer value. | ||
37 | The //IPluginTemplateReplacerParams// type provides access to the following properties: | ||
38 | * **getPlaceholder()** complete string of the placeholder (this includes the markup of the placeholder). | ||
39 | * **getPlaceholderContent()** content of the placeholder (without type-specific markup) | ||
40 | * **getEntityContext()** current user context, for example to be able to perform database operations | ||
41 | * **getMandant()** current client in whose scope the TemplateReplacer is executed | ||
42 | |||
43 | **Return values:** | ||
44 | The return value must be of type //IPluginTemplateReplacerRetVal//. A reference implementation is provided by the //PluginGenericReplacerRetVal// class, which is initialised with the replacement value from the //IPluginTemplateReplacer//. | ||
45 | {{/panel}} |