Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 细枝文件-使所有字段显示在一列中,而不是两列中_Php_Drupal_Twig - Fatal编程技术网

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
更改为仅标记