1

我想在文件中包含所有网格元素的配置。因此,当我将我的 CE 后端布局存储在后端时,它可以正常工作

mod.web_layout.BackendLayouts {
  exampleKey {
    title = Example
    icon = EXT:my_ext/Gridelements/Teaser/Resources/Public/Icons/icon.gif
    config {
      backend_layout {
        colCount = 1
        rowCount = 1
        rows {
          1 {
            columns {
              1 {
                name = Content
                colPos = 0
              }
            }
          }
        }
      }
    }
  }
}

但是如果我在 TSConfig 中设置配置,内容不会呈现。

tx_gridelements {
  overruleRecords = 1
  setup {
    2-Teaser {
      title = Teaser
      description = Teaser
      icon = EXT:my_ext/Gridelements/Teaser/Resources/Public/Icons/icon.gif
      topLevelLayout = 0
      config {
        colCount = 1
        rowCount = 1
        rows {
          1 {
            columns {
              1 {
                name = Content
                colPos = 0
              }
            }
          }
        }
      }
    }
  }
}

gridelements找到这个模板,但是没有渲染内容

tt_content.gridelements_pi1.20.10.setup {
  1 < lib.gridelements.defaultGridSetup
  1 {
    cObject = FLUIDTEMPLATE
    cObject.file = EXT:my_ext/Gridelements/Teaser/Resources/Private/Templates/Template.html
  }
}
4

2 回答 2

3

有点晚了,但我也遇到了同样的问题gridelements-TYPO3 8.7 LTS特别是文件中的配置,就像你一样。我已经从CE BackendLayouts我的文件系统中复制了源代码,这是我的错。这是正确的代码:

页面TS

tx_gridelements {

    setup {

      SectionColoured {

        title = LLL:EXT:yourext/Resources/Private/Language/...
        description = LLL:EXT:yourext/Resources/Private/Language/...

        # optional #icon = EXT:yourext/Resources/Public/Images/...

        # optional # flexformDS = FILE:EXT:yourext/Configuration/FlexForms/Gridelements/SectionColoured.xml

        config {

            colCount = 1
            rowCount = 1
            rows {
              1 {
                columns {
                  1 {
                    name = LLL:EXT:yourext/Resources/Private/Language/...
                    colPos = 101
                  }
                }
              }
            }

        }

      } 
   }
}

TS

// loaded ts after install the ext:gridelements
[userFunc = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('gridelements')]
    <INCLUDE_TYPOSCRIPT: source="FILE:EXT:gridelements/Configuration/TypoScript/setup.ts" extensions="ts">
[global]

tt_content.gridelements_pi1 =< lib.contentElement
    tt_content.gridelements_pi1 {
    templateName = Generic
    variables {
        content =< tt_content.gridelements_view
    }
}

tt_content {
    gridelements_pi1 = COA
    gridelements_pi1 {
        20 {
            10 {
                setup {
                    SectionColoured < lib.gridelements.defaultGridSetup
                    SectionColoured {
                        cObject = FLUIDTEMPLATE
                        cObject {
                            file = EXT:yourext/Resources/Private/Extensions/Gridelements/SectionColoured.html
                        }
                    }
                }
            }
        }
    }
}

tt_content.gridelements_view < tt_content.gridelements_pi1

网格元素模板文件位于:EXT:yourext/Resources/Private/Extensions/Gridelements/SectionColoured.html

<section class="main-content {data.flexform_colour}">
    <article>
        <f:format.raw>{data.tx_gridelements_view_columns.101}</f:format.raw>
    </article>
</section>

现在它起作用了!

于 2018-08-13T08:12:55.593 回答
1

由于您的后端布局不是1而是2-Teaser,因此您的 TypoScript 设置必须与该标识符匹配:

tt_content.gridelements_pi1.20.10.setup {
  2-Teaser < lib.gridelements.defaultGridSetup
  2-Teaser {
    cObject = FLUIDTEMPLATE
    cObject.file = EXT:my_ext/Gridelements/Teaser/Resources/Private/Templates/Template.html
  }
}
于 2018-03-14T09:27:02.477 回答