Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typo3 在Powermail 2.x中创建动态字段_Typo3_Typoscript_Extbase - Fatal编程技术网

Typo3 在Powermail 2.x中创建动态字段

Typo3 在Powermail 2.x中创建动态字段,typo3,typoscript,extbase,Typo3,Typoscript,Extbase,我对powermail 2.x的扩展名有疑问 我的实际需求是,我有一个表单(自定义扩展),通过它我可以使用邮政编码搜索一些地方。因此,一旦用户提交了值(例如邮政编码),webiste将被重定向到页面,我将该邮政编码下的所有可用位置列为链接。当用户点击该链接时,该网站将被重定向到另一个页面,在该页面上我配置了powermail 2.x扩展。我想实现的是,基于单击的链接(我将通过链接传递place\u id,每个地方都有一些成员类型)。我想在单选按钮中显示一组成员类型(使用url中的参数从另一个表中

我对powermail 2.x的扩展名有疑问

我的实际需求是,我有一个表单(自定义扩展),通过它我可以使用邮政编码搜索一些地方。因此,一旦用户提交了值(例如邮政编码),webiste将被重定向到页面,我将该邮政编码下的所有可用位置列为链接。当用户点击该链接时,该网站将被重定向到另一个页面,在该页面上我配置了powermail 2.x扩展。我想实现的是,基于单击的链接(我将通过链接传递
place\u id
,每个地方都有一些成员类型)。我想在单选按钮中显示一组成员类型(使用url中的参数从另一个表中获取)。这些项目应该在预览和邮件中也有

我们可以在powermail 1.6中使用$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FieldHook']实现同样的功能吗

我们如何在powermail 2.x中实现同样的功能

任何帮助都会被占用吗?

最后我自己设法修好了

你所要做的就是

在PowerSample表单中添加一个新的复选框字段,在扩展选项卡中,您可以指定一个打字脚本变量,如lib.products

lib.products = CONTENT
lib.products {
table = pages
select {
  pidInList = xxx
}
renderObj = COA
renderObj {
  10 = COA
  10 {
    10 = TEXT
    10.dataWrap = {field:title}[\n]
  }
}
}
上面的代码将在前端生成动态单选按钮。同样,如果您希望在powermail字段中创建自定义字段类型

tx_powermail.flexForm.type.addFieldOptions.new = Name of the field
tx_powermail.flexForm.type.addFieldOptions.new.dataType = 1 (If it is an array)
然后添加下面的打字稿代码

plugin.tx_powermail.view {
 partialRootPath >
 partialRootPaths {
    10 = EXT:powermail/Resources/Private/Partials/
    20 = EXT:extension/Resources/Private/Partials/
   }
 }
并创建一个模板文件
EXT:extension/Resources/Private/Partials/New.html
。在该文件中,可以包含字段(复选框单选按钮或选择框)

之后

$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\SignalSlot\Dispatcher');
$signalSlotDispatcher->connect(
  'In2code\Powermail\Controller\FormController',
  'formActionBeforeRenderView',
  'HEV\Extension\Controller\FormController',
  'customfucntion',
   FALSE
);
我们必须实现powermail 2.X中可用的信号插槽

而且在

/**
 * @param \In2code\Powermail\Domain\Model\Form $form
 * @param \In2code\Powermail\Controller\FormController $pObj
 */
public function manipulateMailObjectOnCreate($form, $pObj) {
    $sectionNr      = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP("SID");
    if ( !isset( $sectionNr ))
    return ;
    foreach ( $form as $forms ){
        foreach( $forms->getPages() as $key => $pages){
            foreach ( $pages->getFields() as $fields ){
                switch ( $fields->getType() ){
                    case "new":
                        $fields->setMandatory(TRUE);
                        $fields->setCreateFromTyposcript('lib.products');
                    break;
                }
            }
        }
    }
}