When creating a new block the saved bean object is not assigned to the $form_state. So when trying to use the new
auto created object data(ex. delta or bid) in a form submission handler and assign it to other modules we get NULL values.
Simply adding $form_state['values']['bean'] = $bean; after the $bean->save() method is called in bean_form_submit function
is solving the problem.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | bean-add-bean-object-to-form-1978808.patch | 548 bytes | k.minkov |
Comments
Comment #1
k.minkov commentedComment #2
k.minkov commentedComment #3
k.minkov commentedComment #4
k.minkov commentedComment #5
saltednutShouldn't we only do the array assignment inside
if ($bean->save()) {}to make sure this is complete?Comment #6
k.minkov commentedThis will not change anything actually, because in bean_form_validate there is an assignment already:
which assigns NULL when adding bean and the bean object itself on edit.
So the 'bean' element of $form_state['values'] is already set at this point.
Comment #7
saltednutAh duh - okay, this looks good to me.
Comment #8
saltednuthttp://drupalcode.org/project/bean.git/commit/5c3c3ad