Domanda

What code is responsible for adding - in front of taxonomy term sublevels on a taxonomy field in a node edit form?

screenshot

Even though the most non-intrusive way to override it is preferred, I'm comfortable even with core patches.

È stato utile?

Soluzione

Looks like there is no easy way to override them, they are added by TermSelection::getReferenceableEntities in core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php:73:

$options[$vocabulary->id()][$term->id()] = str_repeat('-', $term->depth) . Html::escape($this->entityRepository->getTranslationFromContext($term)->label());

If you decide to edit it, I suggest using a Composer patch system afterwards if you are using Composer.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a drupal.stackexchange
scroll top