I wanted to use editable fields with HS select, but on the first update call from HS, it would remove all default items from the dropbox. It seems $form_state['storage']['hs'][$hsid] was getting lost in the process of calling _hs_process_attach_css_js. I added it during the _hs_process_attach_css_js call based on $element['#default_values']. I'm sure there is a better way to do this, but this is what I came up with. Sorry no patch at this time.
if (! isset($form_state['storage']['hs'][$hsid])){
$defaultselections = _hierarchical_select_dropbox_reconstruct_lineages_save_lineage_enabled($element['#config']['module'], $element['#default_value'], $element['#config']['params']);
$selectionitems = array();
foreach ( $defaultselections as $key=>$value){
$temparray = array();
foreach($value as $subkey => $subvalue){
$temparray[] = $subvalue['value'];
}
$selectionitems[] = $temparray;
}
$form_state['storage']['hs'][$hsid]['dropbox_lineages_selections'] = $selectionitems;
}
Comments
Comment #1
kars-t commentedPlease provide a patch for this issue.
Comment #2
wim leersAre you referring to http://drupal.org/project/editablefields?
Comment #3
dshields commentedI believe that nathanhilbert was referring to http://drupal.org/project/editablefields
It seems that these two modules don't play nicely with one another.
Comment #4
wim leersThat project is all fragile hackery IIRC. We cannot support that.
Comment #5
Gunfigter100 commentedFor anyone else who comes across this issue, I fixed this problem by using hook_form_alter() to add a custom function to the #preprocess attribute array of the offending field.
array_unshift($form['field_my_field']['und']['#process'], 'mymodule_fix_editablefield_hs_lineage');This custom function contains the code that nathanhilbert supplied above with some slight modification.
The code must be prepended to the #process attribute of the field because if it runs after form_hierarchical_select_process() it does not take effect.
Comment #6
eit2103 commentedGunfigter100 cant thank you enough, you saved me hours!