Search code examples
typo3typoscripttypo3-9.x

How to set up tt_address 4.x to work with insert_records in TYPO3 9 LTS


I'm setting up tt_address for one of our customers. He wants to show single address records with the insert records element. But sadly I didn't have any idea or found a tutorial on how to do that with tt_address 4.3

I have tried to adapt the code from tx_news, but it didn't work out.

My code at the moment looks like this:

tt_content.shortcut.20.tables := addToList(tt_address)
tt_content.shortcut.20.conf.tt_address = USER
tt_content.shortcut.20.conf.tt_address {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    extensionName = TtAddress
    pluginName = ListView
    vendorName = FriendsOfTYPO3

    switchableControllerActions {
        Address {
            1 = show
        }
    }
    settings =< plugin.tt_address.settings
    settings {
        insertRecord = 1
        singleRecords.field = uid
        useStdWrap = singleRecords
    }
}
# For fluid_styled_content
tt_content.shortcut.variables.shortcuts.tables := addToList(tt_address)
tt_content.shortcut.variables.shortcuts.conf.tt_address < tt_content.shortcut.20.conf.tt_address

Solution

  • Here is my TypoScript Configuration:

    tt_content.shortcut.20.tables := addToList(tt_address)
    tt_content.shortcut.20.conf.tt_address = USER
    tt_content.shortcut.20.conf.tt_address {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        extensionName = TtAddress
        pluginName = ListView
        vendorName = FriendsOfTYPO3
        action = list
        settings =< plugin.tt_address.settings
        settings {
            insertRecord = 1
            singleRecords.field = uid
            useStdWrap = singleRecords
            displayMode = single
        }
    }
    # For fluid_styled_content
    tt_content.shortcut.variables.shortcuts.tables := addToList(tt_address)
    tt_content.shortcut.variables.shortcuts.conf.tt_address < tt_content.shortcut.20.conf.tt_address
    

    In order that the address get rendered you have to adapt the displayMode_single section of the tt_address template, because the element is not in a array called addresses, but in the propertie contentObjectData.

    <f:section name="displayMode_single">
    <f:if condition="{addresses}">
        <f:then>
            <f:for each="{addresses}" as="address">
                <div class="c-employee__wrapper">
                    <f:render partial="Full" arguments="{_all}"/>
                </div>
            </f:for>
        </f:then>
        <f:else>
            <f:render partial="Full" arguments="{address: contentObjectData}"/>
        </f:else>
    </f:if>