I've successfully created a CRC, extending modResource, per
http://rtfm.modx.com/revolution/2.x/developing-in-modx/advanced-development/custom-resource-classes/creating-a-resource-class
And I've successfully linked an custom table, extending xPDOSimpleObject, per
http://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/developing-an-extra-in-modx-revolution
My schema and model are good. I can add the custom fields to the resource/create and resource/update forms by injecting HTML from the OnDocFormRender event, similar to the ClassExtender extra. Data is read and written to the custom table correctly.
Injecting the HTML alone, however, has it's disadvantages:
- Don't seem to be able to take advantage of MODExt components, such as the datetime picker or checkboxes
- Fields don't appear in Form Customization to be controlled by security profiles
- Fields are outside the panel layout DOM.
So instead, I've copied the loadCustomCssJs() function into my controllers, and modified a copy of modx.panel.resource.js to add the custom fields to the Create/Edit form. However I can't figure out where to populate those fields with the custom data or save it back to the custom table.
I've looked at both:
manager/controllers/default/resource/update.class.php
core/model/modx/processors/resource/update.class.php
per the CRC tutorial and can't find where it's setting and saving the fields, but I'm sure I'm just overlooking it.
Edit:
Using Revo 2.3.1: is there a simpler way to do this in 2.3 than replicating the entire loadCustomCssJs() function and modx.panel.resource.js?
[ed. note: smaddock last edited this post 12 years, 1 month ago.]