CFLib.org – Common Function Library Project

getFunctionHint(somefunction)

Last updated July 1, 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 "";
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson