Closed kuiche closed 9 years ago
I may be wrong but would using a plus operator not work and be a more elegant solution?
e.g.
$choices = ['none' => 'None'] + $choices;
hmm, i thought that basically just did an array merge but i defiantly could be wrong.
Edit: you were right
This came about due to a problem from within commerce. Try creating a product which has variants with values which look like integers. For example "Value":"20".
Then try assigning to a page using the
Productoption
Field. If you look at the generated select box, the values which look like numbers will have wrong values. Something like<option value="4">20</option>
where the value should be 20.This is due to array_merge resetting integer keys. This change means that integer keys are preserved.