Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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;
...
Comment | File | Size | Author |
---|---|---|---|
#2 | hierarchical_select-config_not_defined_1457252-2.patch | 790 bytes | amaria |
#1 | hierarchical_select-config_not_defined_1457252-1.patch | 811 bytes | GuyPaddock |
Comments
Comment #1
GuyPaddock CreditAttribution: GuyPaddock commentedThe attached patch should correct this issue.
Comment #2
amaria CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: yosef.homsy commentedComment #11
yosef.homsy CreditAttribution: yosef.homsy commentedthis link solve the issue
Comment #12
yosef.homsy CreditAttribution: yosef.homsy commented