1<cfscript>
2 // example custom verb that compiles to a <cfdump> tag
3 // usage:
4 // 1. add the lexicon declaration to your circuit file:
5 // <circuit xmlns:cf="cf/">
6 // 2. use the verb in a fuseaction:
7 // <cf:dump var="#somevariable#" />
8 // <cf:dump label="some label" var="#somevariable#" />
9 //
10 // how this works:
11 // a. validate the attributes passed in (fb_.verbInfo.attributes)
12 // b. in start mode, generate the required CFML
13 // c. in end mode, do nothing (this tag does not nest)
14 //
15 if (fb_.verbInfo.executionMode is "start") {
16 //
17 // validate attributes:
18 // var is required:
19 if (not structKeyExists(fb_.verbInfo.attributes,"var")) {
20 fb_throw("fusebox.badGrammar.requiredAttributeMissing",
21 "Required attribute is missing",
22 "The attribute 'var' is required, for a 'dump' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
23 }
24 // label is optional, create the text to generate - note the quoting technique:
25 if (structKeyExists(fb_.verbInfo.attributes,"label")) {
26 fb_.label = 'label="#fb_.verbInfo.attributes.label#"';
27 } else {
28 fb_.label = '';
29 }
30 //
31 // start mode:
32 fb_appendLine('<cfdump #fb_.label# var="#fb_.verbInfo.attributes.var#">');
33 } else {
34 //
35 // end mode - do nothing
36 }
37</cfscript>