Closed (fixed)
Project:
e-Commerce
Version:
6.x-4.x-dev
Component:
ec_store
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Jul 2010 at 14:49 UTC
Updated:
3 Jan 2014 at 01:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Soren Jones commentedComment #2
Soren Jones commentedFor reference, making the following changes in form.inc also stops the warning.
line 1418 of form.inc in function theme_select
Before
return theme('form_element', $element, '<select name="'. $element['#name'] .''. ($multiple ? '[]' : '') .'"'. ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="'. $element['#id'] .'" '. $size .'>'. form_select_options($element) .'</select>');After
return theme('form_element', $element, '<select name="'. (isset($element['#name']) ? $element['#name'] : '') .''. ($multiple ? '[]' : '') .'"'. ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="'. (isset($element['#id']) ? $element['#id'] : '') .'" '. $size .'>'. form_select_options($element) .'</select>');line 1428 of form.inc in function form_select_options
Before
$value_is_array = is_array($element['#value']);After
$value_is_array = is_array(isset($element['#value']) ? $element['#value'] : FALSE);$value_is_array = isset($element['#value']) ? is_array($element['#value']) : FALSE;Comment #3
Soren Jones commentedComments in the PHP manual regarding this issue:
http://www.php.net/manual/en/language.types.array.php#87713
http://www.php.net/manual/en/language.types.array.php#89425
Comment #4
Soren Jones commentedSee #815032: Weird form api usage in ec_store.inc for an explanation of why $element[#name] etc. aren't set in the $state_select array.
Summary: To get Drupal to render a JS select element so the JS select element will inherit the same styling as the other select elements.
The solution to the above issue was to add the following line to the $state_select array:
'#parents' => array('state_select'),Comment #5
gordon commentedLoading patch up for testing.
Comment #6
gordon commentedCommitted to dev, thanks
Comment #7
Soren Jones commentedGordon,
If you have time...
For reference, is there something that could be done differently in form.inc in (e.g.) Drupal 8?
I really like the way that you've done this.
I think the pattern(?) would be useful to people in general.
I'll mark this as fixed in 24 hours if you haven't.
Thank you.
Soren
Comment #8
gordon commentedComment #11
Soren Jones commentedChanging title back.