Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: InvalidArgumentForHashGenerationException #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions Classes/ViewHelpers/Form/RegisterFieldViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,10 @@
*/
class RegisterFieldViewHelper extends AbstractFormFieldViewHelper
{
public function initializeArguments(): void
{
$this->registerArgument('name', 'string', 'Name of input tag');
$this->registerArgument('value', 'mixed', 'Value of input tag');
$this->registerArgument(
'property',
'string',
'Name of Object Property. If used in conjunction with <f:form object="...">, "name" and "value" properties will be ignored.'
);
$this->registerArgument('additionalAttributes', 'array', 'Additional tag attributes. They will be added directly to the resulting HTML tag.', false);
$this->registerArgument('checked', 'bool', 'Specifies that the input element should be preselected');
$this->registerArgument('multiple', 'bool', 'Specifies whether this checkbox belongs to a multivalue (is part of a checkbox group)', false, false);
}

public function render(): string
{
$nameAttribute = $this->getName();

$checked = $this->arguments['checked'];
$multiple = $this->arguments['multiple'];

$propertyValue = null;
if ($this->hasMappingErrorOccurred()) {
$propertyValue = $this->getLastSubmittedFormData();
}
if ($checked === null && $propertyValue === null) {
$propertyValue = $this->getPropertyValue();
}

if ($propertyValue instanceof \Traversable) {
$propertyValue = iterator_to_array($propertyValue);
}
if (is_array($propertyValue)) {
$nameAttribute .= '[]';
} elseif ($multiple === true) {
$nameAttribute .= '[]';
}

$this->registerFieldNameForFormTokenGeneration($nameAttribute);

return '';
Expand Down
4 changes: 1 addition & 3 deletions Resources/Private/Partials/Form/Field/Check.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{namespace vh=In2code\Powermail\ViewHelpers}
<f:spaceless>
<headlesspowermail:form.registerField property="{field.marker}."
value="{setting.value}"
checked="{vh:misc.prefillMultiField(field:field, mail:mail, cycle:iteration.cycle)}"/>
<headlesspowermail:form.registerField property="{field.marker}." />
<f:format.raw>
<f:format.json value="{
field: {
Expand Down
4 changes: 1 addition & 3 deletions Resources/Private/Partials/Form/Field/Country.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{namespace vh=In2code\Powermail\ViewHelpers}
<f:spaceless>
<f:variable name="fieldMarker" value="{field.marker}{f:if(condition:field.multiselect,then:'.')}" />
<headlesspowermail:form.registerField property="{fieldMarker}"
value="{setting.value}"
checked="{vh:misc.prefillMultiField(field:field, mail:mail, cycle:index.cycle)}"/>
<headlesspowermail:form.registerField property="{fieldMarker}" />
<f:format.raw>
<f:format.json value="{
field: {
Expand Down
4 changes: 1 addition & 3 deletions Resources/Private/Partials/Form/Field/Radio.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{namespace vh=In2code\Powermail\ViewHelpers}
<f:spaceless>
<headlesspowermail:form.registerField property="{field.marker}."
value="{setting.value}"
checked="{vh:misc.prefillMultiField(field:field, mail:mail, cycle:iteration.cycle)}"/>
<headlesspowermail:form.registerField property="{field.marker}." />
<f:format.raw>
<f:format.json value="{
field: {
Expand Down
4 changes: 1 addition & 3 deletions Resources/Private/Partials/Form/Field/Select.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{namespace vh=In2code\Powermail\ViewHelpers}
<f:spaceless>
<f:variable name="fieldMarker" value="{field.marker}{f:if(condition:field.multiselect,then:'.')}" />
<headlesspowermail:form.registerField property="{fieldMarker}"
value="{setting.value}"
checked="{vh:misc.prefillMultiField(field:field, mail:mail, cycle:iteration.cycle)}"/>
<headlesspowermail:form.registerField property="{fieldMarker}" />
<f:format.raw>
<f:format.json value="{
field: {
Expand Down