CCAPI Updating Elements
Overview
The CCAPI Element object allows you to add/edit content for textblocks and custom elements. It requires that your site have a proper CCAPI Config file established in the site where you would like to use the CCAPI
Example Usage
<cfscript>
// custom element sample
tmp = structNew();
tmp.field1 = "test";
tmp.field2 = "test 2";
// get the content object from the factory
csContentObj = server.ADF.getBean("CSContent_1_0");
// call populate content (sorry I wish it was more difficult then that)
results = csContentObj.populateContent("elementName", tmp);
</cfscipt>
<cfscript>
// textblock sample
tmp = structNew();
tmp.textblock = "test";
tmp.caption = "test 2";
// get the content object from the factory
csContentObj = server.ADF.getBean("CSContent_1_0");
// call populate content (sorry I wish it was more difficult then that)
results = csContentObj.populateContent("elementName", tmp);
</cfscipt>
<cfscript>
// custom element sample with update
tmp = structNew();
tmp.field1 = "test";
tmp.field2 = "test 2";
tmp.dataPageID = 29333;
// get the content object from the factory
csContentObj = server.ADF.getBean("CSContent_1_0");
// call populate content (sorry I wish it was more difficult then that)
results = csContentObj.populateContent("elementName", tmp);
</cfscipt>
Based on the "name" of the element passed in, the component will find the configuration from the CCAPI Config file and load the proper pageID/elementID combo - and then populate content.
Updating Content
By default if you are working with a textblock content will always be updated. If you would like to update a Custom Element record then be sure to add "dataPageID" into your data struct (see example above). You will receive the "dataPageID" in your render handler or if you use CEData - it will be the "pageID" field for the record you are using.
Chaining Updates with Page Creates
If you would like to chain a page creation with a page content update then you can also add the "pageID"/"subsiteID" combo to your data before passing to the populateCustomElement method.
Note: You would be more likely to chain a populateCustom Element with a createPage if the page you were creating contained a Local Custom Element
Note: dataPageID = the Custom Element Instance Record pageID = the pages ID which contains a Custom Element