Populate a section list editor with data from a different section list

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 8, 2016   (RSS)

By kkegans - July 7, 2016 - edited: July 7, 2016

Is there a way to populate a section list editor with the content from a different section list editor?

I have a need to create a number of list editors that will use mostly the same list details, but each needs to be able to be separately edited. It would be really nice if I could create a master section editor that would automatically pre-populate each of the other page section editors..

CMSB Rocks!



By Daryl - July 7, 2016

Hi Kurt,

One way to do that is to create a custom plugin that is hooked to "record_postsave" plugin hook.

This hook will call the plugin function after a record is saved, ie, in your "master section".
The data from the "master" section will be pass over as an argument to your function where you can add/insert them to other section.

Example usage of a plugin hook:

Plugin Name: Example plugin

addAction('record_postsave', 'update_other_sections_records_function', null, 4);
function update_other_sections_records_function($tableName, $isNewRecord, $oldRecord, $recordNum) {
  // insert/update records from other sections here

In the above example:

$isNewRecord is equals to "1" if the record is new.
$oldRecord is an array that contains the data from the "master section"


Daryl Maximo
PHP Programmer - interactivetools.com

By kkegans - July 8, 2016

Thanks Daryl,

In this case, if the "master section" is subsequently updated, does it have any effect on the other records? If not, is there a method that would allow the other records to be updated when the "master record" was updated?


CMSB Rocks!