如何删除TWIG for Drupal中的部分代码? [英] How to delete part of the code in TWIG for Drupal?

查看:48
本文介绍了如何删除TWIG for Drupal中的部分代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码在其节点中打印标志:

I use this code to print the flag in its node :

{{ content.flag_like_node }}

当我在节点模板中打印我的标志时,呈现如下:

When I print my flag in the template of my node, the rendering is as follows :

<div class="bs-field-like-link"><a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse1"></a><div class="flag flag-like-store js-flag-like-store-13 action-unflag"><a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse1"></a><a title="" href="/fr/flag/details/edit/like_store/13?destination=/fr/boutique/poupette-cacahuete" class="use-ajax" data-dialog-type="modal" data-dialog-options="{&quot;width&quot;:&quot;auto&quot;}" rel="nofollow"><span class="btn btn-success"><svg class="svg-inline--fa fa-heart fa-w-16 fa-lg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="heart" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"></path></svg><!-- <i class="fas fa-heart fa-lg"></i> --> J'aime</span></a></div></div>

<span class="bs-field-like-count">
    2
  </span>

我只想打印以下代码,如何用TWIG删除不必要的代码?

I want to print only the following code, how can I delete the unnecessary code with TWIG ?

<span class="bs-field-like-count">
    2
  </span>


推荐答案

您是否使用标记模块

如果是这样,请覆盖模板

要覆盖模板,只需从模块中复制一个模板并将其放置在主题模板文件夹中,然后根据需要进行修改即可。

To override the template, just copy the one from the module and place the copy in your themes templates folder, then just modify it how you want.

这篇关于如何删除TWIG for Drupal中的部分代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆