During the callback to create a new item in any hierarchical select widget, the following error appears in the system log:
Notice: Undefined variable: config in _hs_process_render_create_new_item() (line 561 of hierarchical_select/hierarchical_select.module).
The issue is that _hs_process_render_create_new_item() does, in fact, attempt to pass in a non-existent configuration array into the call _hierarchical_select_create_new_item_is_allowed():
...
function _hs_process_render_create_new_item($element, $hierarchy) {
$creating_new_item = FALSE;
if (isset($element['#value']['hierarchical_select']['selects'])) {
foreach ($element['#value']['hierarchical_select']['selects'] as $depth => $value) {
if ($value == 'create_new_item' && _hierarchical_select_create_new_item_is_allowed($config, $depth)) { // Line 561
$creating_new_item = TRUE;
...
Comments
Comment #1
guypaddock commentedThe attached patch should correct this issue.
Comment #2
amaria commentedThanks for the patch GuyPaddock. I received a Fatal error trying to apply it so I made the changes manually and created a new patch which works for me.
Comment #3
wim leersLooks almost ready. You don't need to wrap the "$value == …" check in parentheses though!
Comment #4
summit commentedHi,
What should the correct writing for $value been please to apply this change? And can it be committed then please?
EDIT: I see it should be:
Thanks a lot in advance!
Greetings, Martijn
Comment #5
wim leersI made the necessary minor changes, then committed & pushed; I credited GuyPaddock.
http://drupalcode.org/project/hierarchical_select.git/commit/bdf5f82
Comment #6
mr.alinaki commentedHave similar issue, but in line 582:
Notice: Undefined variable: config in _hs_process_render_create_new_item() (line 582 of /home/alinaki/www/htdocs/hierarchical_select/hierarchical_select.module).Changing $config in line 582 to $element['#config'] breaks new level creation.
Comment #7
wim leers#6: then please open a new issue. Don't reopen fixed ones unnecessarily. Preferably, also provide a patch.
Comment #9
yosef.homsy commentedDear all even with the fix patch still receiving this error
Notice: Undefined variable: config in _hs_process_render_create_new_item() (line 583 of /var/www/html/sites/all/modules/hierarchical_select/hierarchical_select.module).
please any help
Comment #10
yosef.homsy commentedComment #11
yosef.homsy commentedthis link solve the issue
Comment #12
yosef.homsy commented