Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TYPO3
sg_mail
Commits
8b5d30d7
Commit
8b5d30d7
authored
Mar 25, 2019
by
Torsten Oppermann
Browse files
[TASK] Correct implementation of the form handling
parent
2956afd2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Classes/Finisher/Forms/FormsFinisher.php
View file @
8b5d30d7
...
...
@@ -71,6 +71,8 @@ class FormsFinisher extends AbstractFinisher {
}
$markers
=
[];
$markerLabels
=
[];
foreach
(
$formValues
as
$identifier
=>
$value
)
{
$formElement
=
$formDefinition
->
getElementByIdentifier
(
$identifier
);
if
(
!
$formElement
)
{
...
...
@@ -83,11 +85,18 @@ class FormsFinisher extends AbstractFinisher {
}
$formElementProperties
=
$formElement
->
getProperties
();
$markerNameArray
=
[];
if
(
isset
(
$formElementProperties
[
'markerName'
])
&&
\
trim
(
$formElementProperties
[
'markerName'
])
!==
''
)
{
$markerName
=
\
trim
(
$formElementProperties
[
'markerName'
]);
$markerNameArray
=
GeneralUtility
::
trimExplode
(
','
,
\
trim
(
$formElementProperties
[
'markerName'
]),
FALSE
,
2
);
$markerName
=
$markerNameArray
[
0
];
}
else
{
$markerNameArray
[
0
]
=
$identifier
;
$markerNameArray
[
1
]
=
$identifier
;
$markerName
=
$identifier
;
}
$markerLabels
[
$markerNameArray
[
0
]]
=
$markerNameArray
[
1
];
$markerName
=
RegisterService
::
normalizeFormFieldMarkerName
(
$markerName
);
$markers
[
$markerName
]
=
$value
;
}
...
...
@@ -102,7 +111,7 @@ class FormsFinisher extends AbstractFinisher {
$objectManager
=
GeneralUtility
::
makeInstance
(
ObjectManager
::
class
);
$mailTemplateService
=
$objectManager
->
get
(
MailTemplateService
::
class
,
$templateName
,
$extensionKey
,
$markers
MailTemplateService
::
class
,
$templateName
,
$extensionKey
,
$markers
,
$markerLabels
);
$ignoreMailQueue
=
(
boolean
)
$this
->
parseOption
(
'ignoreMailQueue'
);
...
...
Classes/Service/MailTemplateService.php
View file @
8b5d30d7
...
...
@@ -115,6 +115,11 @@ class MailTemplateService {
*/
private
$markers
;
/**
* @var array $markerLabels
*/
private
$markerLabels
;
/**
* @var string $bccAddresses
*/
...
...
@@ -156,12 +161,14 @@ class MailTemplateService {
* @param string $templateName
* @param string $extensionKey
* @param array $markers
* @param array $markerLabels
* @throws \InvalidArgumentException
*/
public
function
__construct
(
$templateName
=
''
,
$extensionKey
=
''
,
$markers
=
[])
{
public
function
__construct
(
$templateName
=
''
,
$extensionKey
=
''
,
$markers
=
[],
$markerLabels
=
[])
{
$this
->
templateName
=
$templateName
;
$this
->
extensionKey
=
$extensionKey
;
$this
->
markers
=
$markers
;
$this
->
markerLabels
=
$markerLabels
;
/** @var ObjectManager objectManager */
$this
->
objectManager
=
GeneralUtility
::
makeInstance
(
ObjectManager
::
class
);
...
...
@@ -839,6 +846,9 @@ class MailTemplateService {
$allMarker
=
''
;
foreach
(
$markers
as
$key
=>
$value
)
{
if
(
\
array_key_exists
(
$key
,
$this
->
markerLabels
))
{
$key
=
$this
->
markerLabels
[
$key
];
}
if
(
\
is_string
(
$value
))
{
$allMarker
.
=
$key
.
': '
.
$value
.
PHP_EOL
;
}
elseif
(
\
is_array
(
$value
))
{
...
...
Classes/Service/RegisterService.php
View file @
8b5d30d7
...
...
@@ -257,7 +257,8 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
'marker'
=>
$markerName
,
'type'
=>
MailTemplateService
::
MARKER_TYPE_STRING
,
'value'
=>
$marker
[
'value'
],
'description'
=>
$marker
[
'description'
]
'description'
=>
$marker
[
'description'
],
'markerLabel'
=>
$marker
[
'markerLabel'
]
];
}
...
...
Classes/XClass/Form/FormEditorController.php
View file @
8b5d30d7
...
...
@@ -144,21 +144,23 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
$markers
=
[];
foreach
(
$renderables
as
$element
)
{
// if markerName is explicitly set, override the registered identifier
$markerName
=
''
;
$markerArray
=
[];
if
(
isset
(
$element
[
'properties'
][
'markerName'
])
&&
$element
[
'properties'
][
'markerName'
]
!==
''
)
{
$markerArray
=
GeneralUtility
::
trimExplode
(
','
,
$element
[
'properties'
][
'markerName'
],
FALSE
,
2
);
$markerName
=
$markerArray
[
0
];
}
$markerName
=
RegisterService
::
normalizeFormFieldMarkerName
(
$markerName
);
$identifier
=
$markerArray
[
1
]
??
$markerArray
[
0
];
$markerLabel
=
$markerArray
[
0
];
if
(
isset
(
$markerArray
[
1
]))
{
$markerLabel
=
$markerArray
[
1
];
}
$markers
[
$markerName
]
=
[
'identifier'
=>
$
identifier
,
'identifier'
=>
$
markerName
,
'type'
=>
MailTemplateService
::
MARKER_TYPE_STRING
,
'value'
=>
$element
[
'label'
],
'description'
=>
$element
[
'label'
]
'description'
=>
$element
[
'label'
],
'markerLabel'
=>
$markerLabel
];
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment