diff options
-rw-r--r-- | modules/taxonomy.module | 11 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module index 9c6f051ad..6cb25f59b 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -136,10 +136,12 @@ function _taxonomy_confirm_del_vocabulary($vid) { function taxonomy_form_term($edit = array()) { global $vocabulary_id; + if (!$vocabulary_id) { $vocabulary_id = $edit["vid"]; } $vocabulary = taxonomy_get_vocabulary($vocabulary_id); + $form = form_textfield(t("Term name"), "name", $edit["name"], 50, 64, t("Required") . ". " . t("The name for this term. Example: 'Linux'.")); $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") . ". " . t("A description of the term.")); @@ -147,13 +149,16 @@ function taxonomy_form_term($edit = array()) { $form .= _taxonomy_term_select(t("Related terms"), "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, t("Optional") . ". ", 1, "<" . t("none") . ">", array($edit["tid"])); } - if ($vocabulary->hierarchy) { $parent = array_keys(taxonomy_get_parents($edit["tid"])); $children = taxonomy_get_tree($vocabulary_id, $edit["tid"]); - // you can't be son of yourself or your children - $exclude = array_keys($children); + + // you can't be son of yourself nor of your children + foreach ($children as $child) { + $exclude[] = $child->tid; + } $exclude[] = $edit["tid"]; + if ($vocabulary->hierarchy == 1) { $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") . ". " . la(t("Parent term"), array("mod" => "taxonomy", "op" => "help"), "parent") .".", 0, "<" . t("root") . ">", $exclude); } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 9c6f051ad..6cb25f59b 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -136,10 +136,12 @@ function _taxonomy_confirm_del_vocabulary($vid) { function taxonomy_form_term($edit = array()) { global $vocabulary_id; + if (!$vocabulary_id) { $vocabulary_id = $edit["vid"]; } $vocabulary = taxonomy_get_vocabulary($vocabulary_id); + $form = form_textfield(t("Term name"), "name", $edit["name"], 50, 64, t("Required") . ". " . t("The name for this term. Example: 'Linux'.")); $form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") . ". " . t("A description of the term.")); @@ -147,13 +149,16 @@ function taxonomy_form_term($edit = array()) { $form .= _taxonomy_term_select(t("Related terms"), "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, t("Optional") . ". ", 1, "<" . t("none") . ">", array($edit["tid"])); } - if ($vocabulary->hierarchy) { $parent = array_keys(taxonomy_get_parents($edit["tid"])); $children = taxonomy_get_tree($vocabulary_id, $edit["tid"]); - // you can't be son of yourself or your children - $exclude = array_keys($children); + + // you can't be son of yourself nor of your children + foreach ($children as $child) { + $exclude[] = $child->tid; + } $exclude[] = $edit["tid"]; + if ($vocabulary->hierarchy == 1) { $form .= _taxonomy_term_select(t("Parent"), "parent", $parent, $vocabulary_id, t("Required") . ". " . la(t("Parent term"), array("mod" => "taxonomy", "op" => "help"), "parent") .".", 0, "<" . t("root") . ">", $exclude); } |