Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
12abe6a6
Commit
12abe6a6
authored
Dec 05, 2019
by
Carsten Rose
Browse files
Refactor to new class Checkbox() finished.
parent
a8085f6d
Pipeline
#2875
failed with stages
in 1 minute and 56 seconds
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/AbstractBuildForm.php
View file @
12abe6a6
This diff is collapsed.
Click to expand it.
extension/Classes/Core/BuildFormBootstrap.php
View file @
12abe6a6
...
...
@@ -807,7 +807,7 @@ EOF;
// Label
if
(
$formElement
[
FE_BS_LABEL_COLUMNS
]
!=
'0'
)
{
$htmlLabel
=
$this
->
buildLabel
(
$htmlFormElementName
,
$formElement
[
FE_LABEL
],
$addClassRequired
[
FE_LABEL
]
??
''
);
$htmlLabel
=
HelperFormElement
::
buildLabel
(
$htmlFormElementName
,
$formElement
[
FE_LABEL
],
$addClassRequired
[
FE_LABEL
]
??
''
);
}
$html
.
=
$this
->
customWrap
(
$formElement
,
$htmlLabel
,
FE_WRAP_LABEL
,
$formElement
[
FE_BS_LABEL_COLUMNS
],
...
...
extension/Classes/Core/Form/Checkbox.php
View file @
12abe6a6
This diff is collapsed.
Click to expand it.
extension/Classes/Core/Helper/HelperFormElement.php
View file @
12abe6a6
...
...
@@ -20,7 +20,7 @@ class HelperFormElement {
/**
* @var Store
*/
pr
otected
$store
=
null
;
pr
ivate
static
$store
=
null
;
/**
* Expand column $keyName to row array as virtual columns.
...
...
@@ -790,4 +790,74 @@ EOF;
return
$attribute
;
}
/**
* Builds a real HTML hidden form element. Useful for checkboxes, Multiple-Select and Radios.
*
* @param $htmlFormElementName
* @param string $value
*
* @return string
*/
public
static
function
buildNativeHidden
(
$htmlFormElementName
,
$value
)
{
return
'<input type="hidden" name="'
.
$htmlFormElementName
.
'" value="'
.
htmlentities
(
$value
)
.
'">'
;
}
/**
* Set corresponding JSON attributes readonly/required/disabled, based on $formElement[FE_MODE].
*
* @param string $feMode
*
* @return array
* @throws \UserFormException
*/
public
static
function
getJsonFeMode
(
$feMode
)
{
self
::
getFeMode
(
$feMode
,
$dummy
,
$disabled
,
$required
);
return
[
API_FORM_UPDATE_DISABLED
=>
(
$disabled
===
'yes'
),
API_FORM_UPDATE_REQUIRED
=>
(
$required
===
'yes'
)];
}
/**
* Builds a label, typically for an html-'<input>'-element.
*
* @param string $htmlFormElementName
* @param string $label
* @param string $addClass
*
* @return string
* @throws \CodeException
*/
public
static
function
buildLabel
(
$htmlFormElementName
,
$label
,
$addClass
=
''
)
{
$attributes
=
Support
::
doAttribute
(
'for'
,
$htmlFormElementName
);
$attributes
.
=
Support
::
doAttribute
(
'class'
,
[
'control-label'
,
$addClass
]);
$html
=
Support
::
wrapTag
(
"<label
$attributes
>"
,
$label
);
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
*/
public
static
function
getCheckboxRadioOptionId
(
$base
,
$index
,
$type
=
''
)
{
return
$base
.
'-'
.
$index
.
$type
;
}
/**
* Build HelpBlock
*
* @return string
*/
public
static
function
getHelpBlock
()
{
return
'<div class="help-block with-errors hidden"></div>'
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
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