Unverified Commit abebbfb0 authored by larowlan's avatar larowlan
Browse files

Issue #2845361 by claudiu.cristea, Munavijayalakshmi: Don't compute children...

Issue #2845361 by claudiu.cristea, Munavijayalakshmi: Don't compute children and parents of a new term on TermForm
parent 824fff57
......@@ -38,14 +38,17 @@ public function form(array $form, FormStateInterface $form_state) {
// before loading the full vocabulary. Contrib modules can then intercept
// before hook_form_alter to provide scalable alternatives.
if (!$this->config('taxonomy.settings')->get('override_selector')) {
$parent = array_keys($taxonomy_storage->loadParents($term->id()));
$children = $taxonomy_storage->loadTree($vocabulary->id(), $term->id());
// A term can't be the child of itself, nor of its children.
foreach ($children as $child) {
$exclude[] = $child->tid;
$exclude = [];
if (!$term->isNew()) {
$parent = array_keys($taxonomy_storage->loadParents($term->id()));
$children = $taxonomy_storage->loadTree($vocabulary->id(), $term->id());
// A term can't be the child of itself, nor of its children.
foreach ($children as $child) {
$exclude[] = $child->tid;
}
$exclude[] = $term->id();
}
$exclude[] = $term->id();
$tree = $taxonomy_storage->loadTree($vocabulary->id());
$options = ['<' . $this->t('root') . '>'];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment