CFLib.org – Common Function Library Project

getFunctionHint(somefunction)

Last updated July 01, 2010

author

Alan McCollough

Version: 0 | Requires: CF6 | Library: UtilityLib

Description:
Let's say you have a CFC, with a public function. You have populated the hint attribute for that functions so that it is self-documenting. Now you are working on a demo page and want to display the hint for that function. This getFunctionHint() UDF makes it easy. Note: This does not work for private-access functions.

Return Values:
Returns a string.

Example:

If you have a cfc "foo" with a function "bar()", to get the hint, use this syntax: #getFunctionHint(foo.bar)#

Parameters:

Name Description Required
somefunction A CFC method or UDF. Yes

Full UDF Source:

/**
 * You give me a function and I return the hint. Useful for demo and documentation pages.
 * v2 modded by RCamden to support the lack of a hint
 * 
 * @param somefunction      A CFC method or UDF. (Required)
 * @return Returns a string. 
 * @author Alan McCollough (amccollough@anthc.org) 
 * @version 0, July 1, 2010 
 */
function getFunctionHint(somefunction){
    if(structKeyExists(somefunction.metadata, "hint")) return deserializeJSON(serializeJSON(somefunction.metadata.hint));
    return "";
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson