com.sebtools Build 12 Documentation: Customization


Components that extend ProgramManager.cfc can be easily customized by extension. This is easiest to explain by example, so we will use the ContactOMatic.cfc from the AFF Getting Started guide.

The first thing to note is that ProgramManager.cfc components should not have "_" in the file name. This is because that is used to indicate extension. So, if you have ContactOMatic.cfc and you want to customize it on a specific site (leaving the base component untouched), you could create ContactOMatic_Example.cfc (using something to indicate your site in the place of "Example"):

<cfcomponent extends="ContactOMatic" output="no>


From there, you could put in whatever customized code you wanted. If you wanted to customize the Contacts.cfc component, you would need to first make sure Contacts.cfc existed and that you had customized ContactOMatic.cfc as above (even if you don't add any custom code to it).

Then you could create Contacts_Example.cfc:

<cfcomponent extends="Contacts" output="no>


ContactOMatic would know to use Contacts_Example.cfc instead of Contacts.cfc because it has "_Example" in its file name as well.

Adding Fields

To add fields to the component, use the "customxml" method. This should be formatted just like the "xml" method (using and returning the same XML syntax), but need only include additional fields for any table.

The "loadCustomFields" method could also be used, but that method just runs any custom code. It is meant for adding fields using the "setField" method of Manager.cfc.

Adding Components

If you want to add a component to the ProgramManager component, just make sure it needs only Manager.cfc and place it in the same directory as the ProgramManager component.

The ProgramManager will pass three arguments into the "init" method of the component: "Manager" (with Manager.cfc), "Parent" (the ProgramManager component itself) and the ProgramManager by its own name "ContactOMatic" in our example. If you need to change those arguments, then you will need to extend and modify either "loadComponents" or "loadComponent".

If you have a component in the same folder that you do not want to modify, then you will need to extend "getComponentsList". For example, to remove "Example.cfc" from being automatically loaded, use the following code:

<cffunction name="getComponentsList" access="public" returntype="string" output="false" hint="">
	<cfset var result = Super.getComponentsList()>
	<cfset var findloc = ListFindNoCase(result,"Example")>
	<cfif findloc>
		<cfset result = ListDeleteAt(result,findloc)>
	<cfreturn result>