Problem/Motivation

The issue was filed because highest-level taxonomy items were disappearing from the "list terms" taxonomy link upon edit. It was discovered that the reference to them with "0" as their parent was being removed from the taxonomy_term_hierarchy table.

Proposed resolution

It appears that this was because this line: $parent = isset($form['#term']['tid']) ? array_keys(taxonomy_get_parents($form['#term']['tid'])) : array(0); in hs_taxonomy.module was actually leading to the variable $parent being undefined in cases where there was no parent.

The temporary solution was as follows:

Add a condition after this code, where if $parent is defined, set value to array(0 => 0)

if ($parent == array()) {
$form['relations']['parent']['#default_value'] = array(0 => 0);
}

Alternatively, it may be possible to change the code to something like this:

$parent = isset($form['#term']['tid']) ? array_keys(taxonomy_get_parents($form['#term']['tid'])) : array(0 => 0);

To make it work. This is so far untested.

Comments

Gold’s picture

Status: Active » Closed (outdated)

The codebase has moved a long way in the 4 years since this issue was created. I am currently unable to replicate the issue.

Closing as outdated.

If this is still an issue please reopen with step by step instructions to replicate.