Hello! I worked on own module base on Link Module and using Editablefields Module's functionality.
When I click 'Save' button I see (see screenshot in attachmets):
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Service unavailable (with message)
ResponseText: Recoverable fatal error: Argument 1 passed to drupal_array_get_nested_value() must be an array, boolean given, called in Z:\home\localhost\drupal7\sites\all\modules\editablefields\editablefields.module on line 315 and defined in drupal_array_get_nested_value() (line 6508 of Z:\home\localhost\drupal7\includes\common.inc).
I think need modify code in editablefields.module, line 315:
$edit_mode_state = isset($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);
Need Changed to:
if(isset($form_state['edit_mode'])) {
if(!is_array($form_state['edit_mode']) && !$form_state['edit_mode']) {
$form_state['edit_mode'] = array();
}
$edit_mode_state = isset($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);
} else {
$edit_mode_state = FALSE;
}
It need 'cause $form_state['edit_mode'] can contain an empty string, but first argument for drupal_array_get_nested_value should be an array.
Please, review!
Best regards,
Stanislav Potapenko
Comment | File | Size | Author |
---|
Comments
Comment #1
askibinski CreditAttribution: askibinski commentedPatch seems to work for me. Error is gone and field is saved.
Probably needs more testing and review though.
Comment #2
pcdesign CreditAttribution: pcdesign commentedI also tried it, it seems to work form me...
Comment #3
SemasPing CreditAttribution: SemasPing commentedWork for me too
Comment #4
allio_froggio CreditAttribution: allio_froggio commentedI patched but I still get the error. However, I get it when I use the "edit this field" button when the option "click to edit" is selected. Does the patch have to be applied elsewhere?
Also, and this could be unrelated completely, if I leave "click to edit" de-selected, the auto-complete fields do not function (no options are displayed). So, I can't add new values but, I don't get an error. It just doesn't work.
Thanks for any help! Happy Holidays!
Comment #5
j.c.gram CreditAttribution: j.c.gram commentedA potential simpler solution would be to change line 315 from:
$edit_mode_state = isset($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);
to:
$edit_mode_state = isset($form_state['edit_mode']) && is_array($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);
This will also prevent the (albeit very slight) performance hit of running drupal_array_get_nested_value() when $form_state['edit_mode'] is not an array.
Comment #6
illmatix CreditAttribution: illmatix commented#5 worked for me. So far no issues with it.
Comment #7
andreav CreditAttribution: andreav commentedJust a feedback.
I'm on version = "7.x-1.0-alpha2+7-dev", code has slightly changed, cannot apply any patch.
The error now is about string parameter, no more boolean:
... Argument 1 passed to drupal_attributes() must be of the type array, string given ...
Sorry, I'm not able to adapt these patches to new code.
Comment #8
adshill CreditAttribution: adshill commentedPatch in the post works for me.
Patch in #5 didn't work - works first save but further saves don't work.
Comment #9
noahadler CreditAttribution: noahadler commentedOriginal patch worked for me as well.
Comment #10
Kristen PolNeither the original code from the issue summary or the code in #5 is working for me. I'm using the latest dev code.
Comment #11
Kristen PolIt turns out it was an issue with some other javascript clobbering this functionality. The latest dev version is working fine.
Comment #12
dags CreditAttribution: dags commentedWas a fix for this ever actually committed? @Kristen Pol, were you saying that the latest dev works as is, or it works with the patch in #5 applied?
Comment #13
gswebmaster CreditAttribution: gswebmaster commentedI just added the fix to the latest release. It has not been committed.
Comment #14
artbussy CreditAttribution: artbussy commentedMaybe for other users: I installed the stable version today and it seems to work well with the patch from #5. Not without.
Comment #15
pringlz CreditAttribution: pringlz commentedHi! I download alpha2 version yesterday and saw 315 error! stable version is not changed! For me worked fine code from header of post. Please, change stable version!
Comment #16
Jujens CreditAttribution: Jujens commentedSolution given in #5 worked for me.
Comment #17
nooysters CreditAttribution: nooysters commented#5 fixed ajax errors for me too!
Comment #18
Feral CreditAttribution: Feral commentedStill same problem
#5 didn't work.
Just latest dev version works.
Comment #19
pebosi CreditAttribution: pebosi commentedWhen using current Dev Version, try removing line 552:
Without this, no error occurs, and it still works for me.
Regards
Comment #20
pebosi CreditAttribution: pebosi commentedComment #21
mparker17This issue is be a duplicate of #1206656: Error on Node view page: Argument 1 passed to drupal_array_get_nested_value(), which is already in the 7.x-1.x-dev version. I've confirmed that running either the
7.x-1.x-dev
version of the module, or applying the patch in #1206656-65: Error on Node view page: Argument 1 passed to drupal_array_get_nested_value() works for me.Comment #22
Lingaraj_M CreditAttribution: Lingaraj_M commented@skinpot, Works for me
if(isset($form_state['edit_mode'])) {
if(!is_array($form_state['edit_mode']) && !$form_state['edit_mode']) {
$form_state['edit_mode'] = array();
}
$edit_mode_state = isset($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);
} else {
$edit_mode_state = FALSE;
}
Comment #23
drvdt CreditAttribution: drvdt commented#19 and remove one more line below that line. Worked!
_field_invoke_default('extract_form_values', $element['#entity_type'], $entity, $form, $form_state);
_field_invoke('validate', $element['#entity_type'], $entity, $errors);