Islandora-Collaboration-Group / islandora_webform

islandora_webform
GNU General Public License v3.0
6 stars 8 forks source link

Cloning an xml form element should remove redundant multi-value child fields #27

Closed patdunlavey closed 8 years ago

patdunlavey commented 8 years ago

When iwi_set_form_element_byhash clones a tab, it copies all the children of that tab, including tags and even tabsets which themselves are multi-value fields. The purpose of this cloning is to give us a copy of the form element's complete schema, and none of its data.

Currently, iwi_set_form_element_byhash sets the values of all descendants of the cloned element to NULL. However, when one of the children is a multi-value field, it leaves those multiple instances in place, setting all their values to NULL. Instead, it should remove all but one of them. In this way, we preserve the form element schema without carrying over a "ghost" of NULL values reflecting all the data that existed in the original.

patdunlavey commented 8 years ago

Tagging @DiegoPino

patdunlavey commented 8 years ago

Question: Should we always remove/nullify cloned multi-value (tab, tag) child elements in this function, or should there be an argument to the function "reset_clone" that can be set to TRUE or FALSE? If so, should "reset_clone" = TRUE be the default? Perhaps let this be indicated somehow in the $mode argument?

patdunlavey commented 8 years ago

As commented in this pull request: https://github.com/commonmedia/islandora_webform/pull/28/files#r49488474, We only are trying to clone the structure of the descendent special xmlform elements, not their data. So there is no reason to keep more than one.

We can close this issue when that pull request is accepted.