0
votes

i have a normal TYPO3 TCA Group Element via XML:

<tabNavi>
    <ROOT>
        <TCEforms>
            <sheetTitle>Tab Navi</sheetTitle>
        </TCEforms>
        <type>array</type>
        <el>
            <!-- Tab Navi Settings -->
            <settings.tabNavi.headlines>
                <TCEforms>
                    <label>Auswahl der Tabs</label>
                    <config>
                        <type>group</type>
                        <internal_type>db</internal_type>
                        <allowed>tt_content</allowed>
                        <size>5</size>
                        <minitems>0</minitems>
                        <maxitems>6</maxitems>
                        <show_thumbs>1</show_thumbs>
                        <wizards>
                            <_PADDING>1</_PADDING>
                            <_VERTICAL>1</_VERTICAL>
                            <suggest>
                                <type>suggest</type>
                                <default>
                                    <searchWholePhrase>1</searchWholePhrase>
                                </default>
                            </suggest>
                        </wizards>
                    </config>
                </TCEforms>
            </settings.tabNavi.headlines>
        </el>
    </ROOT>
</tabNavi>

and here the Controller PHP:

class ElementsController extends BaseController {

    /**
    * @var \TYPO3\CMS\Extbase\Object\ObjectManager
    * @inject
    */
    protected $objectManager;

    /**
    */
    public function setObjectManager($objectManager)
    {
        $this->objectManager = $objectManager;
    }

    /**
    * @return mixed
    */
    public function getObjectManager()
    {
        return $this->objectManager;
    }

    /**
    * @return void
    */
    public function tabNaviAction()
    {

    }
}

and here the TYPO3 FLUID Code:

<nav class="content-nav-tabs sticky affix-top">
    <ul class="nav nav-tabs item-detail-tabs">
        <li role="presentation" class="active"><a href="#top" rel="nofollow" title="Übersicht">Übersicht</a></li>
        <f:debug>{settings.tabNavi.headlines}</f:debug>


        <f:for each="{settings.tabNavi.headlines}" as="navTabsItem">
            <li role="presentation"><a href="#c{navTabsItem.uid}" rel="nofollow" title="{navTabsItem.header}">{navTabsItem.header}</a></li>
        </f:for>
    </ul>
</nav>

But for the right output I need an ARRAY, not a string. If I use the Vhs "v:iterator.explode" it works fine for the uid´s from tt_content, but I don't need the uid, I need the object behind the uid.

All I get is the normal Comma-UID-List: https://docs.typo3.org/typo3cms/TCAReference/6.2/Reference/Columns/Group/Index.html#the-comma-list-method-default

What can I do ? Do I need another php in the Controller? Thanks!

2

2 Answers

1
votes

Use the v:content.get view helper in a loop and set the tt_content uid list as parameter

<f:for each="{v:content.get(contentUids: {settings.tabNavi.headlines -> v:iterator.explode()}, render: 'FALSE')}" as="element">
  …
</f:for>

Something like that, I didn't try this myself now, but you get the idea … hth

0
votes

this works fine:

<f:for each="{v:content.get(contentUids: '{settings.tabNavi.headlines -> v:iterator.explode()}', render: 'FALSE')}" as="navTabsItem">
    {navTabsItem.header}
</f:for>

Thanks @Wolfgang