扩展flexform中的FAL图像字段

时间:2014-06-04 07:58:45

标签: php typo3 typo3-6.2.x

是否可以像普通的tt_content元素一样创建一个flexform FAL图像字段? 我想在扩展flexform字段中实现以下屏幕中显示的功能。

enter image description here

我已经创建了一个flexform元素,但在翻译默认内容元素记录时遇到了问题。当我翻译默认内容元素时,图像不会被复制到翻译元素。

所以我需要实现flexform FAL图像字段而没有翻译错误。

2 个答案:

答案 0 :(得分:13)

希望这会有所帮助 - 我使用flexforms和FAL开发了一个图像滑块。这是代码:

Flexform配置(仅适用于images-field)

<settings.sliderImages>
        <TCEforms>
            <label>LLL:EXT:bwrk_slider/Resources/Private/Language/locallang_db.xlf:imageslider.flex.general.sliderImages</label>
            <config>
                <type>inline</type>
                <maxitems>99</maxitems>
                <foreign_table>sys_file_reference</foreign_table>
                <!--<foreign_field>uid_foreign</foreign_field>-->
                <foreign_table_field>tablenames</foreign_table_field>
                <foreign_label>uid_local</foreign_label>
                <foreign_sortby>sorting_foreign</foreign_sortby>
                <foreign_selector>uid_local</foreign_selector>
                <foreign_selector_fieldTcaOverride type="array">
                    <config>
                        <appearance>
                            <elementBrowserType>file</elementBrowserType>
                            <elementBrowserAllowed>jpg,png</elementBrowserAllowed>
                        </appearance>
                    </config>
                </foreign_selector_fieldTcaOverride>
                <foreign_match_fields type="array">
                    <fieldname>image</fieldname>
                </foreign_match_fields>
                <appearance type="array">
                    <newRecordLinkAddTitle>1</newRecordLinkAddTitle>
                    <headerThumbnail>
                        <field>uid_local</field>
                        <height>64</height>
                        <width>64</width>
                    </headerThumbnail>
                </appearance>
            </config>
        </TCEforms>
    </settings.sliderImages>

我的分机控制器

        $resourceFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
        $sliderItems = array();
        $sliderItemUids = $this->settings['sliderImages'];
        $sliderItemUids = explode(',', $sliderItemUids);

        if(!empty($sliderItemUids)){
            $arraySize = sizeof($sliderItemUids);
            for($i = 0; $i < $arraySize; $i++){

                $itemUid = $sliderItemUids[$i];

                $fileReference = $resourceFactory->getFileReferenceObject($itemUid);
                $fileArray = $fileReference->getProperties();
                array_push($sliderItems, $fileArray);
            }
        }

        // debug($this->settings['sliderImages']);
        $this->view->assign('sliderItems', $sliderItems);

<强>流体-模板

<f:for each="{sliderItems}" as="item">
    <div class="slider-item">
        <div class="slider-item-img">
            <f:image src="{item.uid}" alt="..." treatIdAsReference="TRUE" />
        </div>
        <div class="slider-item-text"></div>
    </div>
</f:for>

答案 1 :(得分:0)

效果很好,但是如果你不在插件中添加图像,你将以异常结束。所以我稍微调整了一下代码:

//JS_PROBLEMS.js
var l = 0;
for(var a = 100; a < 1000; a++) {
    for(var b = 100; b < 1000; b++) {
        var p = (a*b).toString();
        var t = "";
        for(var i = p.length; i >= 0; i--) {
            t += p[i];
            if ( ( (a*b) > l) && (p.localeCompare(t) == 0) ) {//extra bracket needed here after the 0
                l = a * b;
            }
        }
    }
}
document.write(l);