-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormBuilder.cfc
40 lines (33 loc) · 1.13 KB
/
FormBuilder.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* A widget that renders form based on slug from a form built in the FormBuilder Module
*/
component extends="contentbox.model.ui.BaseWidget" singleton{
FormBuilder function init(controller){
// super init
super.init(controller);
// Widget Properties
setPluginName("FormBuilder");
setPluginVersion("1.0");
setPluginDescription("A widget that renders a form built in the FormBuilder Module");
setPluginAuthor("Curt Gratz");
setPluginAuthorURL("www.compknowhow.com");
setForgeBoxSlug("cbwidget-formbuilder");
return this;
}
/**
* Renders FormBuilder form
* @slug.hint The form slug to render
* @defaultValue.hint The string to show if the form slug does not exist
*/
any function renderIt(required string slug, string defaultValue){
var content = runEvent(event='contentbox-formbuilder:formRender.renderForm',eventArguments=arguments);
if( !isNull(content) ){
return content;
}
// default value
if( structKeyExists(arguments, "defaultValue") ){
return arguments.defaultValue;
}
throw(message="The content slug '#arguments.slug#' does not exist",type="FormBuilderWidget.InvalidFormBuilderSlug");
}
}