summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.admin.inc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/taxonomy/taxonomy.admin.inc')
-rw-r--r--modules/taxonomy/taxonomy.admin.inc24
1 files changed, 15 insertions, 9 deletions
diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc
index 96ef32f15..97f1300c3 100644
--- a/modules/taxonomy/taxonomy.admin.inc
+++ b/modules/taxonomy/taxonomy.admin.inc
@@ -275,17 +275,23 @@ function taxonomy_form_term(&$form_state, $vocabulary, $edit = array()) {
'#collapsed' => TRUE,
);
- $parent = array_keys(taxonomy_get_parents($edit['tid']));
- $children = taxonomy_get_tree($vocabulary->vid, $edit['tid']);
+ // taxonomy_get_tree and taxonomy_get_parents may contain large numbers of
+ // items so we check for taxonomy_override_selector before loading the
+ // full vocabulary. Contrib modules can then intercept before
+ // hook_form_alter to provide scalable alternatives.
+ if (!variable_get('taxonomy_override_selector', FALSE)) {
+ $parent = array_keys(taxonomy_get_parents($edit['tid']));
+ $children = taxonomy_get_tree($vocabulary->vid, $edit['tid']);
+
+ // A term can't be the child of itself, nor of its children.
+ foreach ($children as $child) {
+ $exclude[] = $child->tid;
+ }
+ $exclude[] = $edit['tid'];
- // A term can't be the child of itself, nor of its children.
- foreach ($children as $child) {
- $exclude[] = $child->tid;
+ $form['advanced']['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary->vid, t('Parent terms') .'.', 1, '<'. t('root') .'>', $exclude);
+ $form['advanced']['relations'] = _taxonomy_term_select(t('Related terms'), 'relations', array_keys(taxonomy_get_related($edit['tid'])), $vocabulary->vid, NULL, 1, '<'. t('none') .'>', array($edit['tid']));
}
- $exclude[] = $edit['tid'];
-
- $form['advanced']['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary->vid, t('Parent terms') .'.', 1, '<'. t('root') .'>', $exclude);
-
$form['advanced']['synonyms'] = array(
'#type' => 'textarea',
'#title' => t('Synonyms'),