Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
e2ed910d
Commit
e2ed910d
authored
Dec 03, 2019
by
Carsten Rose
Browse files
Refs #9691: HTML ID for checkbox elements
parent
8477faeb
Pipeline
#2853
passed with stages
in 3 minutes and 28 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/AbstractBuildForm.php
View file @
e2ed910d
...
...
@@ -2257,6 +2257,8 @@ abstract class AbstractBuildForm {
if
(
$formElement
[
FE_MODE
]
==
FE_MODE_READONLY
)
{
$checkboxClass
.
=
' qfq-disabled'
;
// necessary for own style checkboxes to display them 'disabled'
}
// Used in getFormElementForJson() for dynamic update.
$formElement
[
'_checkboxClass'
]
=
$checkboxClass
;
$br
=
''
;
...
...
@@ -2265,7 +2267,8 @@ abstract class AbstractBuildForm {
$jsonValue
=
false
;
$attribute
=
$attributeBase
;
$htmlFormElementNameUniq
=
HelperFormElement
::
prependFormElementNameCheckBoxMulti
(
$htmlFormElementName
,
$ii
,
true
);
$attribute
.
=
Support
::
doAttribute
(
'id'
,
$formElement
[
FE_HTML_ID
]
.
'-'
.
$ii
);
$checkboxId
=
$this
->
checkboxRadioOptionId
(
$formElement
[
FE_HTML_ID
],
$ii
);
$attribute
.
=
Support
::
doAttribute
(
'id'
,
$checkboxId
);
$attribute
.
=
Support
::
doAttribute
(
'name'
,
$htmlFormElementNameUniq
);
$attribute
.
=
Support
::
doAttribute
(
ATTRIBUTE_DATA_REFERENCE
,
$formElement
[
FE_DATA_REFERENCE
]
.
'-'
.
$ii
);
...
...
@@ -2294,7 +2297,8 @@ abstract class AbstractBuildForm {
// $htmlElement = Support::wrapTag('<label>', $htmlElement);
// }
$htmlElement
=
Support
::
wrapTag
(
"<label class='
$checkboxClass
'
$attributeBaseLabel
>"
,
$htmlElement
,
true
);
$checkboxLabelId
=
$this
->
checkboxRadioOptionId
(
$formElement
[
FE_HTML_ID
],
$ii
,
'l'
);
$htmlElement
=
Support
::
wrapTag
(
"<label class='
$checkboxClass
'
$attributeBaseLabel
id='
$checkboxLabelId
'>"
,
$htmlElement
,
true
);
// control orientation
if
(
$formElement
[
FE_MAX_LENGTH
]
>
1
)
{
...
...
@@ -2315,6 +2319,23 @@ abstract class AbstractBuildForm {
return
$html
;
}
/**
* Construct HTML ID for checkbox/radio option elements.
* Optional add $type.
* Example: $base='173-21612-1-0', $index='0', $type='l' >> '173-21612-1-0-0-l'
*
* @param $base
* @param $index
* @param string $type - ';' for label
* @return string
*/
private
function
checkboxRadioOptionId
(
$base
,
$index
,
$type
=
''
)
{
if
(
$type
!=
''
)
{
$type
=
'-'
.
$type
;
}
return
$base
.
'-'
.
$index
.
$type
;
}
/**
* Submit extra (hidden) values by SIP.
*
...
...
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