I got below error on my site recently.
Notice: Undefined index: parent in taxonomy_form_term_submit() (line 829 of /var/www/Sites/xxxxx/modules/taxonomy/taxonomy.admin.inc).
I google it and find there is an old issue but seems nothing solved.
In the issue, @Cracu did mention some part of core code may cause this error:
if (!variable_get('taxonomy_override_selector', FALSE)) { $parent = array_keys(taxonomy_get_parents($term->tid)); $children = taxonomy_get_tree($vocabulary->vid, $term->tid); // A term can't be the child of itself, nor of its children. foreach ($children as $child) { $exclude[] = $child->tid; } $exclude[] = $term->tid; $tree = taxonomy_get_tree($vocabulary->vid); $options = array('<' . t('root') . '>'); if (empty($parent)) { $parent = array(0); } foreach ($tree as $item) { if (!in_array($item->tid, $exclude)) { $options[$item->tid] = str_repeat('-', $item->depth) . $item->name; } } $form['relations']['parent'] = array( '#type' => 'select', '#title' => t('Parent terms'), '#options' => $options, '#default_value' => $parent, '#multiple' => TRUE, ); }
I try to look into the latest core, this part of code is still there with same logics. Unfortunately, I need taxonomy_override_selector
be TRUE
.
Apart from setting taxonomy_override_selector
to FALSE
or adding new form validation handler to set $form_state['values']['parent']
.
Do anyone know if there is solution for that?
Sponsored by SupremePR