form validate done incorrectly - and solution
| Project: | Creative Commons |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | balleyne |
| Status: | closed |
Jump to:
I think you are "adding" your form code incorrectly to the node form that the CC form is being added to:
if (creativecommons_node_type_is_enabled($node->type)) {
$form = array_merge($form, creativecommons_node_form($form['#node'], $form_state));
}array_merge isn't doing what you think here, if prior to merge one of the keys in the array already existed it will be wiped, not merged as you'd think, so even though $form['creativecommons'] gets added, $form['#validate'] and $form['#submit'] wipe out the existing values for these.
from php manual:
"If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended. "
using array_merge_recursive() will do the right thing here.

#1
Thanks! Just committed your recommended fix.
#2
Automatically closed -- issue fixed for 2 weeks with no activity.