Drupal 如何检查产品类型的机器名称?

Drupal 如何检查产品类型的机器名称?,drupal,twig,drupal-8,drupal-commerce,Drupal,Twig,Drupal 8,Drupal Commerce,我有下面的细枝代码。它检查“Produit”是否在产品类型的名称中 我的问题是: 我希望它检查产品类型的机器名称(而不是机器名称的标题),在我的例子中是product 你是怎么做到的 {% if 'Produit' in message.field_product_reference.entity.field_pop_up_product_reference.entity.type.entity.label %} <a href="{{ path('entity.co

我有下面的细枝代码。它检查“Produit”是否在产品类型的名称中

我的问题是:

我希望它检查产品类型的机器名称(而不是机器名称的标题),在我的例子中是
product

你是怎么做到的

  {% if 'Produit' in message.field_product_reference.entity.field_pop_up_product_reference.entity.type.entity.label %}
    <a href="{{ path('entity.commerce_product.canonical', {'commerce_product': message.field_product_reference.entity.field_pop_up_product_reference.entity.id}) }}" title="{{ message.field_product_reference.entity.field_pop_up_product_reference.entity.title.value }}" class="stretched-link"></a>
  {% else %}
    <a href="{{ path('entity.commerce_product.canonical', {'commerce_product': message.field_product_reference.entity.id}) }}" title="{{ message.field_product_reference.entity.title.value }}" class="stretched-link"></a>
  {% endif %}
{%if'Produit'在message.field\u product\u reference.entity.field\u pop\u product\u reference.entity.type.entity.label%}
{%else%}
{%endif%}

尝试
实体.bundle
而不是
标签
:)

{{message.field\u product\u reference.entity.type.entity.bundle}
它不工作,它显示
商业产品类型