所有的gridelements配置只在文件中

时间:2018-01-19 17:13:36

标签: typo3 tx-gridelements

我想在文件中包含所有的gridelements配置。 因此,当我在后端存储我的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
  }
}

2 个答案:

答案 0 :(得分: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
  }
}

答案 1 :(得分:1)

有点晚了,但是gridelementsTYPO3 8.7 LTS遇到了同样的问题-尤其是像您这样的文件配置。 我已经从文件系统中的CE BackendLayouts复制了SourceCode,这是我的错。这是正确的代码:

PageTS

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

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

现在可以了!