我是Drupal的新手,我非常喜欢它。我正在自己学习,但现在我陷入了一个问题。Drupal 8 - 添加类到链接
我创建了一个显示标题和链接列表的自定义块。所以该块中唯一的字段是类型链接。这是我的页脚区域块。所以当用户点击时,它会在新标签中打开一个新网站。
我要改变的HTML输出只是此块类型,所以我拿出这个主题建议: 场 - 块内容 - 现场链接 - 英尺,links.html.twig
我的问题是如何为每个<a>
标签添加一个类?
我试过使用模块'链接类'。它的作品越野车。它只会在安装模块之前读取已经存在于css中的类。它不会读取安装模块后创建的新类。我尝试了不同的东西,清除了缓存很多次,但很奇怪。必须有更好的方式来添加没有模块的类。
任何人都可以帮助我,并告诉我添加一个类到我的<a>
标签的最佳方式吗?
谢谢:)
下面是
{% if label_hidden %}
{% if multiple %}
<div{{ attributes }}>
{% for item in items %}
<div{{ item.attributes }}>{{ item.content }}</div>
{% endfor %}
</div>
{% else %}
{% for item in items %}
{{ item.content }} -------------> add class here
{% endfor %}
{% endif %}
{% else %}
<div{{ attributes }}>
<div{{ title_attributes }}>{{ label }}</div>
{% if multiple %}
<div>
{% endif %}
{% for item in items %}
<div{{ item.attributes }}>{{ item.content }}</div>
{% endfor %}
{% if multiple %}
</div>
{% endif %}
</div>
{% endif %}