我有一个自定义内容元素的插件。该插件包含一个flexform。我想在我的TypoScript设置中使用flexform中的值。我该怎么做呢?
更具体地说,flexform定义为:
<T3DataStructure>
<meta>
<langDisable>1</langDisable>
</meta>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:cb_foundation/Resources/Private/Language/locallang_db.xlf:magellan.sheetTitle</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.magellan.cols>
<TCEforms>
<label>LLL:EXT:cb_foundation/Resources/Private/Language/locallang_db.xlf:magellan.cols</label>
<config>
<type>input</type>
<size>20</size>
<eval>trim</eval>
</config>
</TCEforms>
</settings.magellan.cols>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>我的自定义元素是使用以下TypoScript添加到tt_content的:
lib.cb_foundation.magellan = HMENU
lib.cb_foundation.magellan {
1 = TMENU
1 {
sectionIndex = 1
sectionIndex.type = header
sectionIndex.useColPos = 0
wrap = <div data-magellan-expedition="fixed"><dl class="sub-nav"> | </dl></div>
NO {
allWrap = <dd data-magellan-arrival="c{field:sectionIndex_uid}">|</dd>
allWrap.insertData = 1
}
}
special = list
special.value.data = page:uid
}
tt_content.cbfoundation_magellan =< lib.cb_foundation.magellan我想做的是使用在flexform中找到的值来设置tt_content.cbfoundation_magellan.1.sectionIndex.useColPos。我该怎么做呢?
发布于 2014-07-17 05:47:50
这是不可能的。不幸的是,Typoscript不能解析flexform中的值。
您需要一个extbase控制器或pi1来从flexform中获取值,并将它们分配给一个单独的模板,该模板将呈现您的自定义内容元素。
Extbase示例:
class ContentElementsController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
public function YourContentElementAction() {
// Get the data object (contains the tt_content fields)
$data = $this->configurationManager->getContentObject()->data;
// Append flexform values
$this->configurationManager->getContentObject()->readFlexformIntoConf($data['pi_flexform'], $data);
// Assign to template
$this->view->assign('data', $data);
}
}发布于 2016-07-26 21:36:45
我不知道是扩展网格还是TYPO3 6.2.26带来了这个功能,但是下面这些对我来说是有效的:
dataWrap = {field:flexform_YOURFIELD}发布于 2016-10-13 03:22:52
下面的StackOverflow答案描述了如何使用一个小型StackOverflow用户类从TS设置中访问EXT新闻的插件flexform设置:
https://stackoverflow.com/a/40006158/430742
它应该很容易适应其他插件及其flexform设置。
https://stackoverflow.com/questions/24790016
复制相似问题