如何在 Typoscript 中使用 Fluid cObject 数据

How to use Fluid cObject data in Typoscript

我有以下流畅的脚本来插入错别字库:

<f:cObject typoscriptObjectPath="lib.artteaser" data="{imgclass: 'img-cover'}"/>

我想在 FILES.renderObj 中的打字稿中使用 "data" 参数作为 css class 的包装 - 以下是我尝试过的方法很远,但没有用。

lib.artteaser = COA
lib.artteaser {

    wrap = <section><div class="container"><div class="row cover-teaserbox">|</div></div></section>

    10 = CONTENT
    10 {
        table = tt_content
        select {
            [...]
        }

        renderObj = COA
        renderObj {

            wrap = <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 col-xl-3 cover-teaserbox-item">|</div>

            10 = FILES
            10 {

                references {
                    [...]
                }

                renderObj = IMAGE
                renderObj {
                    file.import.data = file:current:uid
                    file.crop.data = file:current:crop
                    file.treatIdAsReference = 1
                    altText.data = file:current:title

                    # the following did not work
                    stdWrap.dataWrap = <div class="cover-teaserbox-item-img {field:imgclass}">|</div>

                    stdWrap.typolink {
                        parameter.field =  pid
                    }
                }

                maxItems = 1

            }

            [...]

        }

    }

}

有人可以给我一个提示让这个工作吗?提前致谢!

每次使用 currentfield:*data = * 时都需要考虑上下文。

在输入您的 TS 对象时,您将所有 'parameters' 作为当前上下文。但是只要您构建菜单或处理记录 (CONTENT),单个记录(如果是菜单,页面记录)就是当前上下文。

在您的情况下,您可以将参数存储到寄存器中并在以后使用。

lib.artteaser = COA
lib.artteaser {

    5 = LOAD_REGISTER
    5 {
        imageClass.field = imgclass
    }

    10 = CONTENT
    10 {
           :
           :
               stdWrap.dataWrap = <div class="cover-teaserbox-item-img {register:imageClass}">|</div>
           :
           :
    }
}