variables.defaultFAversion = "4.4"; variables.defaultIconDataFile = "/ADF/thirdParty/css/font-awesome/#variables.defaultFAversion#/data/icon-data.csv"; var inputParameters = application.ADF.data.duplicateStruct(arguments.parameters); var currentValue = arguments.value; // the field's current value var readOnly = (arguments.displayMode EQ 'readonly') ? true : false; var iconDataArr = ArrayNew(1); var fontArray = ArrayNew(1); var iconDataFilePath = ''; var cftErrMsg = ''; var curVal = ''; var selected_index = ''; var a = 0; var i = 0; var selected = ""; var s = ""; var cftPath = "/ADF/extensions/customfields/font_awesome_select"; inputParameters = setDefaultParameters(argumentCollection=arguments); if ( StructKeyExists(inputParameters,"iconDataFile") AND LEN(TRIM(inputParameters.iconDataFile)) ) iconDataFilePath = ExpandPath(inputParameters.iconDataFile); // Get the Full File Path to the IconDataFile // Make sure the data file exists if ( FileExists(iconDataFilePath) ) { // Convert the CSV file to an array iconDataArr = application.ADF.data.csvToArray(file=iconDataFilePath,Delimiter=","); } else { cftErrMsg = "Unable to load icon data file!"; if ( StructKeyExists(inputParameters,"iconDataFile") AND LEN(TRIM(inputParameters.iconDataFile)) ) cftErrMsg = cftErrMsg & "
'#inputParameters.iconDataFile#'"; } // Build the Font Awesome Icons array for ( a=1; a LTE ArrayLen(iconDataArr); a=a+1 ) { ArrayAppend( fontArray, '#iconDataArr[a][1]#,#iconDataArr[a][2]#' ); } // Set the curVal for( i=1; i lte ArrayLen(fontArray); i=i+1 ) { if ( ListFirst(fontArray[i]) eq currentValue ) { curVal = "#ListLast(fontArray[i])# #ListFirst(fontArray[i])#"; break; } }
renderJSFunctions(argumentCollection=arguments, fieldParameters=inputParameters);
#ListFirst(currentValue, ' ')#
disabled="disabled" class="fa-searchInput" placeholder="Type to filter list of icons">
#cftErrMsg#
  • #ListFirst(fontArray[i])#
Size:   checked="checked">   checked="checked">   checked="checked">   Pull:
var inputParameters = application.ADF.data.duplicateStruct(arguments.fieldParameters); var defaultFAversion = variables.defaultFAversion; var defaultIconDataFile = variables.defaultIconDataFile; var inputParameters = application.ADF.data.duplicateStruct(arguments.parameters); // Set the defaults if( NOT StructKeyExists(inputParameters,'ShowSize') ) inputParameters.ShowSize = 0; if( NOT StructKeyExists(inputParameters,'ShowFixedWidth') ) inputParameters.ShowFixedWidth = 0; if( NOT StructKeyExists(inputParameters,'ShowBorder') ) inputParameters.ShowBorder = 0; if( NOT StructKeyExists(inputParameters,'ShowSpin') ) inputParameters.ShowSpin = 0; if( NOT StructKeyExists(inputParameters,'ShowPull') ) inputParameters.ShowPull = 0; // Fix for bad version folder "Major.Minor.Maintenance". Should only be "Major.Minor" version. // - If the "4.2.0" folder is found, use the default icon data file value if( NOT StructKeyExists(inputParameters,'iconDataFile') OR LEN(TRIM(inputParameters.iconDataFile)) EQ 0 OR FindNoCase("/ADF/thirdParty/css/font-awesome/4.2.0/",inputParameters.iconDataFile)) inputParameters.iconDataFile = defaultIconDataFile; // Validate if the property field has been defined if ( NOT StructKeyExists(inputParameters, "fldID") OR LEN(inputParameters.fldID) LTE 0 ) inputParameters.fldID = arguments.fieldName; return inputParameters; private any function getValidationJS(required string formName, required string fieldName, required boolean isRequired) { if (arguments.isRequired) return 'hasValue(document.#arguments.formName#.#arguments.fieldName#, "TEXT")'; return ""; } private string function getValidationMsg() { return "Please select a value for the #arguments.label# field."; } private boolean function isMultiline() { return true; } /* IMPORTANT: Since loadResourceDependencies() is using ADF.scripts loadResources methods, getResourceDependencies() and loadResourceDependencies() must stay in sync by accounting for all of required resources for this Custom Field Type. */ public void function loadResourceDependencies() { // Load registered Resources via the ADF scripts_2_0 application.ADF.scripts.loadJQuery(); application.ADF.scripts.loadFontAwesome(); } public string function getResourceDependencies() { return "jQuery,FontAwesome"; }