如何在Drupal/Twig视图中获取分类学术语ID
希望你一切都好。 我从Drupal开始。 我被要求更改
如果我插入这是视图< p> {{content.field_solution_by_default}}}</p>
它将正确打印字段的文本,但要更改
任何人都知道这样做的任何方法,我已经尝试了以下内容:
{{attribute(content.field_solution_by_default,datavalue)}}}
{{drupal_field(content,field_solution_by_default,tid)}}}
{{content.field_solution_by_default.0 ['#saxonomy_term'] ['tid']}}}
{{content.field_solution_by_default ['#galsonomy_term'] [0] .value}}}
PHP 7.3 Drupal 9.3
hope you doing well.
I'm starting with drupal.
and i was asked to change a
if i insert this is the view <p>{{ content.field_solution_by_default}}</p>
it will print the Text of the field correctly, but to change the
any one knows any way of doing this, i already tryed the followings:
{{ attribute(content.field_solution_by_default, datavalue) }}
{{ drupal_field(content, field_solution_by_default, tid) }}
{{ content.field_solution_by_default.0['#taxonomy_term']['tid'] }}
{{ content.field_solution_by_default['#taxonomy_term'][0].value }}
php 7.3
drupal 9.3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的。假设您使用分类法创建了一个视图,并定义了以标题,正文和分类法显示的字段:在这种情况下,我称其为
type_pf
(经常询问问题类型):那样,该字段,显示在视图中。
也就是说,我不知道为什么它向我显示ID,而不是分类法的名称:
仍然有帮助。
Good. Assuming that you created a view with the taxonomies and defined the fields to show as title, body and the taxonomy: In this case, I call it
type_pf
(frequently asked question type):That way, the fields are displayed in the views.
That said, I don't know why it shows me the id instead the name of the taxonomy in:
Still, this should help.