简体   繁体   English

TYPO3 Femanager Passwort其他属性

[英]TYPO3 Femanager Passwort additionalAttributes

I want to extend the additionalAttributes with a second Attribute. 我想用第二个属性扩展AdditionalAttributes。 In the original Partials it looks like this: 在原始的Partials中,它看起来像这样:

<f:form.password
            id="femanager_field_password_repeat"
            name="password_repeat"
            class="input-block-level"
            value=""
            additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'password_repeat')}" />

I try this: 我尝试这样:

additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'password'),placeholder: '{password_repeat}'}" />

With several Verions of Escaping the femanager:Validation..... Got this Error: 随着逃脱femanager的几个版本:验证...

The argument "additionalAttributes" was registered with type "array", but is of type "string" in view helper "TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\PasswordViewHelper“ 参数“ additionalAttributes”已注册为“数组”类型,但在视图助手“ TYPO3 \\ CMS \\ Fluid \\ ViewHelpers \\ Form \\ PasswordViewHelper”中为“字符串”类型

Any Ideas? 有任何想法吗?

I think 我认为

Validation.FormValidationData() Validation.FormValidationData()

is a viewhelper that returns a whole array which is expected for the attribute "additionalAttributes". 是一个viewhelper,它返回属性“ additionalAttributes”所需的整个数组。 Because of that it's difficult to extend the array at this place. 因此,很难在此位置扩展数组。

But as far as I know the femanager-viewhelper itself offers the possibility to extend the final array, all to do is to give your array as a further argument which is called 'additionalAttributes' as well. 但是据我所知,femanager-viewhelper本身提供了扩展最终数组的可能性,所有要做的就是将数组作为进一步的参数,也称为“ additionalAttributes”。

A short example: 一个简短的例子:

<f:form.password
     property="password"
     additionalAttributes="{
       femanager:Validation.FormValidationData(settings:settings,
       fieldName:'password',   
       additionalAttributes:'{required:\'required\',pattern:\'.{8,}\'}')}"
     }" />

Notice the array of 2 values (required and pattern). 请注意2个值的数组(必需和模式)。

I also recommend to have a look at the viewhelper on github: 我还建议看看github上的viewhelper:

https://github.com/TYPO3-extensions/femanager/blob/master/Classes/ViewHelpers/Validation/FormValidationDataViewHelper.php https://github.com/TYPO3-extensions/femanager/blob/master/Classes/ViewHelpers/Validation/FormValidationDataViewHelper.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM