Php 细枝文件-使所有字段显示在一列中,而不是两列中
我有一个用于我的视图的细枝模板,其中字段显示在两列上。是否有办法使所有字段显示在同一列中 细枝代码:Php 细枝文件-使所有字段显示在一列中,而不是两列中,php,drupal,twig,Php,Drupal,Twig,我有一个用于我的视图的细枝模板,其中字段显示在两列上。是否有办法使所有字段显示在同一列中 细枝代码: {% set index = 0 %} <div class='row'> <div class="panel panel-default"> <div class="panel-body"> {% for key, field in fields -%} {% if index == 0 or index ==
{% set index = 0 %}
<div class='row'>
<div class="panel panel-default">
<div class="panel-body">
{% for key, field in fields -%}
{% if index == 0 or index == 5 %}
<div class='col-md-6'>
{% endif %}
<span {{ field.label_attributes }}>{{ field.label }}{{ field.label_suffix }}</span>
<a href="#" data-toggle="tooltip" data-placement="right" title="{{ tooltips[key] }}">
<span {{ field.element_attributes }}>{{ field.content }}</span><br/>
</a>
{% if index + 1 == fields | length %}
<a href=''>Test link</a>
{% endif %}
{% if index == 4 or index + 1 == fields | length %}
</div>
{% endif %}
{% set index = index + 1 %}
{%- endfor %}
</div>
</div>
</div>
{%set index=0%}
{%用于键,字段中的字段-%}
{%如果索引=0或索引=5%}
{%endif%}
{{field.label}}{{field.label_suffix}}
{%如果索引+1==字段|长度%}
{%endif%}
{%如果索引=4或索引+1==字段|长度%}
{%endif%}
{%set index=index+1%}
{%-endfor%}
电流输出:
如何使所有字段都显示在一列中?您不能使用flex-direction:column将类包装在css中吗。。例如:
.panel-body{
display:flex
flex-direction: column
}
非常简单的修复。我从面板中删除了这个类,它将所有字段都放在一列中
<div class='col-md-6'> changed to just <div> tag
更改为仅标记