简体   繁体   English

斜纹CMS(Laravel):如何设置直放站块? 中继器显示在错误的位置

[英]Twill CMS (Laravel): How to set up Repeater blocks? Repeaters display at wrong place

I wanted to use the repeater blocks of twill for my new project, set it up like in the documentation but it displays outside the section area just right beneath it in the body. 我想在我的新项目中使用斜纹纸的中继器块,像在文档中一样进行设置,但是它显示在主体下面正好位于断面区域之外。 Can´t edit it in the cms. 无法在cms中对其进行编辑。 How do I declare the right variable in the component to link to the repeater items? 如何在组件中声明正确的变量以链接到转发器项目? Or is there something else I forgot? 还是我忘记了其他东西? Couldn´t find anything specific about my issue. 找不到关于我的问题的任何具体信息。

Checked everything multiple times, and tried different syntax and different input types 多次检查所有内容,并尝试了不同的语法和不同的输入类型

../site/blocks/competences.blade.php ../site/blocks/competences.blade.php

@php
/** @var A17\Twill\Models\Behaviors\HasMedias $block */
@endphp
<div class="competences">
    <div class="l-container">
        <div class="competences-wrapper">
            <h1 class="competences-headline">{{ $block->translatedInput('headline') }}</h1>
            {!! $block->input('items') !!}
            </div>
        </div>
    </div>

../admin/blocks/competences.blade.php ../admin/blocks/competences.blade.php

@formField('input', [
    'name' => 'headline',
    'label' => 'Headline',
    'required' => true,
    'translated' => true
])

@formField('repeater', [
    'name' => 'items',
    'type' => 'competences_item'
])

twill.php twill.php

<?php

return [
    'block_editor' => [
        'blocks' => [
            'competences' => [
                'title' => 'Competences',
                'icon' => 'text',
                'component' => 'a17-block-competences'
                ]
        ],
        'repeaters' => [
            'competences_item' => [
                'title' => 'Competences Item',
                'trigger' => 'Add competence',
                'component' => 'a17-block-competences_item',
                'min' => 3,
                'max' => 3
            ]
        ],
    ]
];

should display inside the section/div, but displays beneath it just inside the body with of course no CSS styles 应该显示在section / div内,但是在其下仅显示在主体内,当然没有CSS样式

Fixed it this way:

@php
/** @var A17\Twill\Models\Behaviors\HasMedias $block */
@endphp
<div class="competences">
    <div class="l-container">
        <div class="competences-wrapper">
            <h1 class="competences-headline">{{ $block->translatedInput('headline') }}</h1>
            @foreach ($block->children as $child)
                @include('site.blocks.competences_item', ['child', $child])
            @endforeach
            </div>
        </div>
    </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM