0
votes

I used Gridelements a while now. I used the following code:

TypoScript (Gridelements (deprecated) (gridelements)):

tt_content.gridelements_pi1.20.10.setup {
  2col < lib.gridelements.defaultGridSetup
  2col.cObject = FLUIDTEMPLATE
  2col.cObject.file = {$resDir}/Private/Partials/Gridelements/2spalten.html
}

FLUID Template:

<div class="row">
    <div class="col-md-6">
        {data.tx_gridelements_view_column_0}
    </div>
    <div class="col-md-6">
        {data.tx_gridelements_view_column_1}
    </div>
</div>

PageTS:

tx_gridelements.setup {
    2col {
        title = Two Columns
        config {
            colCount = 2
            rowCount = 1
            rows {
                1 {
                    columns {
                    1 {
                        name = Links
                        colPos = 0
                    }
                    2 {
                        name = Rechts
                        colPos = 1
                    }
                    }
                }
            }
        }
    }
}

But now I want to use "Gridelements w/DataProcessing (recommended) (gridelements)" because the other one is deprecated. But all I see is the error:

Tried resolving a template file for controller action "Standard->2col" in format ".html", but none of the paths contained the expected template file (Standard/2col.html). The following paths were checked: /var/www/html/typo3/sysext/fluid_styled_content/Resources/Private/Templates/, /var/www/html/typo3/typo3conf/ext/gridelements/Resources/Private/Templates/, /var/www/html/typo3/typo3conf/ext/dev_layout/Resources/Private/Templates/

If I write this in my TypoScript code:

lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
    templateRootPaths {
        20 = {$resDir}/Private/Templates/Gridelements/
    }
}
tt_content.gridelements_pi1 < lib.gridelements.defaultGridSetup
tt_content.gridelements_view < tt_content.gridelements_pi1

And when I create the named file, the error no longer appears. But there is no output. I see the divs but no content. How can I switch from deprecated gridelements to dataprocessing gridelements?

3

3 Answers

1
votes

"The documentation is wrong you need this"

tt_content.gridelements_pi1 =< lib.contentElement

Sure? I could still use the original as it is written in the example for w / DataProcessing:

lib.gridelements.defaultGridSetup =< lib.contentElement
0
votes

The problem is that this code

tt_content.gridelements_pi1.20.10.setup {
  2col < lib.gridelements.defaultGridSetup
  2col.cObject = FLUIDTEMPLATE
  2col.cObject.file = {$resDir}/Private/Partials/Gridelements/2spalten.html
}

does not match the new static you included.

Take a look at the basic example shown in the documentation:

https://docs.typo3.org/typo3cms/extensions/gridelements/stable/Chapters/DataProcessing/Index.html

lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
  templateName.field = tx_gridelements_backend_layout
  templateName.ifEmpty = GridElement
  layoutRootPaths {
    1 = EXT:gridelements/Resources/Private/Layouts/
  }
  partialRootPaths {
    1 = EXT:gridelements/Resources/Private/Partials/
  }
  templateRootPaths {
    1 = EXT:gridelements/Resources/Private/Templates/
  }
  dataProcessing {
    10 = GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor
    10 {
      default {
        as = children
        # Default options of the grid children processor
        # Change them according to the needs of your layout
        # Read more about it in the TypoScript section of the manual
        # options {
          # sortingDirection = ASC
          # sortingField = sorting
          # recursive = 0
          # resolveFlexFormData = 1
          # resolveBackendLayout = 1
          # respectColumns = 1
          # respectRows = 1
        # }
      }
    }
  }
}

Now if you want to add your own templates and rendering configurations you just need to add something in dataProcessing.10 like

dataProcessing {
  10 = GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor
  10 {
    2col {
      as = columncontent
      options {
        resolveFlexFormData = 0
        respectRows = 0
      }
    }
    accordion {
      as = accordionitems
      options {
        resolveFlexFormData = 0
        respectRows = 0
        respectColumns = 0
      }
    }
  }
}

The name of the variables can still be children, but it might be more comfortable to deal with variable names matching then purpose of your template.

0
votes

I found the solution:

Template:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<div class="row">
    <f:if condition="{children}">
        <f:for each="{children.1}" as="column" key="columnNumber">
            <div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} col-lg-6">
                <f:for each="{column}" as="child">
                    <f:render partial="Child"
                        arguments="{data: child.data, children: child.children, options: options, settings: settings}" />
                </f:for>
            </div>
        </f:for>
    </f:if>
</div>
</html>

For two different cols

<div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} {f:if(condition: '{columnNumber} == 0', then: 'col-lg-3', else: 'col-lg-9')}">
              

My column numbers are left 0 and right 1

TS in dataprocessing.10:

2col {
  as = children
    options {
      resolveChildFlexFormData = 0
    }
  }
}

The documentation is wrong you need this

tt_content.gridelements_pi1 =< lib.contentElement

TSconfig: Default gridelements TSConfig