如何在代码中获取分类术语的机器名称


how to get machine name of taxonomy term in code?

如何在Drupal 7中具有分类术语ID的代码中获取分类术语的机器名称?

我尝试了taxonomy_term_load(),但它没有返回机器名称。

谢谢。

使用 pathauto's pathauto_cleanstring() 函数清理分类术语的字符串。

本机分类术语不支持计算机名称,例如词汇表。我刚刚开发了一个模块来支持这样的功能。它通过添加一个名为"machine_name"的新字段来更改分类术语属性,该字段可以使用术语名称键入或自动生成。

https://www.drupal.org/project/taxonomy_machine_name

希望对您或其他人有所帮助。

BR

好的,这条路径是由Drupal核心模块"path"生成的,我通过以下方式解决了。

$out_alias = drupal_lookup_path('alias', 'taxonomy/term/3');

第二个选项可能是:

$out_alias = url('taxonomy/term/3');

谢谢你的时间。