Needs work
Project:
Salsa Entity
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2014 at 15:03 UTC
Updated:
28 Apr 2015 at 07:43 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
LukyLuke_ch commentedMissed that the question key in the container must be the same as before and not the container.
Comment #2
s_leu commentedFor single additions to the array I suggest using $element['#default_value'] rather than += array()
After applying the patch and visiting a site with a questionnaire, this code threw notices. Guess the split by ~ should happen outside of the condition. The condition should also check if default[1] contains anything.
Comment #3
LukyLuke_ch commentedThe operator "+=" on arrays adds the new values only if they not already exists - the "$a[]" adds them and overrides existing what we not want here. This is a short version of "$element = array_merge(array('foo' => 'bar'), $element)".
What notices do you get here and on which line? On the explode, the condition or by accessing on the key 1?
In general: We first need to check if there is a "Default_Value", after we can split this up in the various parts, no?
If the "Default_Value" is provided the right way from salsa (and the questionnaire is configured correctly), then there should be no problem with this. The first index holds the field_label and the second the field_name. So if the user has not entered a label for the option, there should also be an empty string in the frontend - also for the default value.
Comment #4
s_leu commentedThe problem is that you just used the same default value without considering the element type. Elements of type "checkboxes" expect an array instead of a string. Adding a new patch that considers this.
Comment #6
berdirPatch contains stuff from another issue.