By claudiu.cristea on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
9.3.x
Introduced in version:
9.3.0
Issue links:
Description:
Some taxonomy.module functions are deprecated. Also, using drupal_static_reset() with taxonomy_vocabulary_get_names() as parameter is deprecated.
Deprecated Taxonomy module functions
taxonomy_vocabulary_get_names()taxonomy_term_uri()taxonomy_term_load_multiple_by_name()taxonomy_terms_static_reset()taxonomy_vocabulary_static_reset()taxonomy_implode_tags()taxonomy_term_title()- Using
drupal_static_reset()withtaxonomy_vocabulary_get_names()as parameter is deprecated.
Replacements
| Before | After |
|---|---|
$vids = taxonomy_vocabulary_get_names(); |
|
|
|
$url = taxonomy_term_uri($term); |
$url = $term->toUrl(); |
taxonomy_terms_static_reset() |
|
taxonomy_vocabulary_static_reset($vids); |
|
taxonomy_implode_tags(); |
\Drupal\Core\Entity\Element\EntityAutocomplete::getEntityLabels() |
$name = taxonomy_term_title($term); |
$name = $term->label(); |
|
|
Impacts:
Module developers
Site templates, recipes and distribution developers
Comments
loadByProperties() is insecure
... so maybe the suggested replacement for
taxonomy_term_load_multiple_by_name()should be adjusted accordingly... Although a truly BC code can be achieved by using loadByProperties()... :rolling-face:https://mglaman.dev/blog/avoid-using-loadbyproperties-load-entities