Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qfq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
typo3
qfq
Commits
e0b1788b
Commit
e0b1788b
authored
5 years ago
by
Carsten Rose
Browse files
Options
Downloads
Patches
Plain Diff
unify attributes for checkboxSingle
parent
58f8fd0f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!221
B9720 checkbox various setups
Checking pipeline status
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extension/Classes/Core/Form/Checkbox.php
+30
-41
30 additions, 41 deletions
extension/Classes/Core/Form/Checkbox.php
with
30 additions
and
41 deletions
extension/Classes/Core/Form/Checkbox.php
+
30
−
41
View file @
e0b1788b
...
...
@@ -17,7 +17,6 @@ namespace IMATHUZH\Qfq\Core\Form;
//use IMATHUZH\Qfq\Core\Helper\OnArray;
//use IMATHUZH\Qfq\Core\Helper\Sanitize;
use
IMATHUZH\Qfq\Core\Helper\Support
;
//use IMATHUZH\Qfq\Core\Report\Link;
//use IMATHUZH\Qfq\Core\Report\Report;
//use IMATHUZH\Qfq\Core\Store\Sip;
...
...
@@ -395,19 +394,30 @@ class Checkbox {
*/
public
function
buildCheckboxSingle
(
array
$formElement
,
$htmlFormElementName
,
$attribute
,
$value
,
array
&
$json
,
$mode
=
FORM_LOAD
)
{
if
(
isset
(
$formElement
[
FE_BUTTON_CLASS
]))
{
// Bootstrap
$attribute
.
=
Support
::
doAttribute
(
'id'
,
$formElement
[
FE_HTML_ID
]);
$attribute
.
=
Support
::
doAttribute
(
'name'
,
$htmlFormElementName
);
$attribute
.
=
Support
::
doAttribute
(
'value'
,
$formElement
[
FE_CHECKBOX_CHECKED
],
false
);
$attribute
.
=
Support
::
doAttribute
(
'data-load'
,
(
$formElement
[
FE_DYNAMIC_UPDATE
]
===
'yes'
)
?
'data-load'
:
''
);
$attribute
.
=
Support
::
doAttribute
(
ATTRIBUTE_DATA_REFERENCE
,
$formElement
[
FE_DATA_REFERENCE
]);
if
(
$formElement
[
FE_BUTTON_CLASS
]
==
''
)
{
$formElement
[
FE_BUTTON_CLASS
]
=
'btn-default'
;
}
$classActive
=
''
;
$valueJson
=
false
;
if
(
$formElement
[
FE_MODE
]
==
FE_MODE_READONLY
)
{
$formElement
[
FE_BUTTON_CLASS
]
.
=
' disabled'
;
}
if
(
$formElement
[
FE_CHECKBOX_CHECKED
]
===
$value
)
{
$attribute
.
=
Support
::
doAttribute
(
'checked'
,
'checked'
);
$valueJson
=
$value
;
}
//$attribute .= HelperFormElement::getAttributeList($formElement, [FE_AUTOFOCUS, F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$attribute
.
=
HelperFormElement
::
getAttributeList
(
$formElement
,
[
FE_AUTOFOCUS
,
F_FE_DATA_REQUIRED_ERROR
]);
return
$this
->
constructCheckboxSingleButton
(
$formElement
,
$htmlFormElementName
,
$attribute
,
$value
,
$json
);
if
(
isset
(
$formElement
[
FE_BUTTON_CLASS
]))
{
// Bootstrap
return
$this
->
constructCheckboxSingleBootstrap
(
$formElement
,
$htmlFormElementName
,
$attribute
,
$value
,
$json
,
$valueJson
);
}
else
{
return
$this
->
constructCheckboxSinglePlain
(
$formElement
,
$htmlFormElementName
,
$attribute
,
$value
,
$json
);
// Plain
return
$this
->
constructCheckboxSinglePlain
(
$formElement
,
$htmlFormElementName
,
$attribute
,
$value
,
$json
,
$valueJson
);
}
}
...
...
@@ -432,27 +442,22 @@ class Checkbox {
* @throws \CodeException
* @throws \UserFormException
*/
public
function
constructCheckboxSingleB
utton
(
array
$formElement
,
$htmlFormElementName
,
$attribute
,
$value
,
array
&
$json
)
{
public
function
constructCheckboxSingleB
ootstrap
(
array
$formElement
,
$htmlFormElementName
,
$attribute
,
$value
,
array
&
$json
,
$valueJson
)
{
$html
=
''
;
$valueJson
=
false
;
$attribute
.
=
Support
::
doAttribute
(
'id'
,
$formElement
[
FE_HTML_ID
]);
$attribute
.
=
Support
::
doAttribute
(
'name'
,
$htmlFormElementName
);
$attribute
.
=
Support
::
doAttribute
(
'value'
,
$formElement
[
FE_CHECKBOX_CHECKED
],
false
);
$attribute
.
=
Support
::
doAttribute
(
'data-load'
,
(
$formElement
[
FE_DYNAMIC_UPDATE
]
===
'yes'
)
?
'data-load'
:
''
);
$attribute
.
=
Support
::
doAttribute
(
FE_INPUT_AUTOCOMPLETE
,
'off'
);
$attribute
.
=
Support
::
doAttribute
(
ATTRIBUTE_DATA_REFERENCE
,
$formElement
[
FE_DATA_REFERENCE
]);
if
(
$formElement
[
FE_BUTTON_CLASS
]
==
''
)
{
$formElement
[
FE_BUTTON_CLASS
]
=
'btn-default'
;
}
if
(
$formElement
[
FE_MODE
]
==
FE_MODE_READONLY
)
{
$formElement
[
FE_BUTTON_CLASS
]
.
=
' disabled'
;
}
$classActive
=
''
;
if
(
$formElement
[
FE_CHECKBOX_CHECKED
]
===
$value
)
{
$attribute
.
=
Support
::
doAttribute
(
'checked'
,
'checked'
);
$valueJson
=
true
;
$classActive
=
' active'
;
}
$attribute
.
=
HelperFormElement
::
getAttributeList
(
$formElement
,
[
'autofocus'
]);
$attribute
.
=
HelperFormElement
::
getAttributeList
(
$formElement
,
[
F_FE_DATA_PATTERN_ERROR
,
F_FE_DATA_REQUIRED_ERROR
,
F_FE_DATA_MATCH_ERROR
,
F_FE_DATA_ERROR
]);
$htmlHidden
=
HelperFormElement
::
buildNativeHidden
(
$htmlFormElementName
,
$formElement
[
FE_CHECKBOX_UNCHECKED
]);
$this
->
store
->
setVar
(
$htmlFormElementName
,
$htmlHidden
,
STORE_ADDITIONAL_FORM_ELEMENTS
,
false
);
$html
=
''
;
...
...
@@ -619,8 +624,7 @@ class Checkbox {
* Create a 'hidden' input field and a 'checkbox' input field - both with the same HTML 'name'.
* HTML does not submit an unchecked checkbox. Then only the 'hidden' input field is submitted.
*
* Format: <input type="hidden" name="$htmlFormElementName" value="$valueUnChecked">
* <input name="$htmlFormElementName" type="radio" [autofocus="autofocus"]
* <input name="$htmlFormElementName" type="radio" [autofocus="autofocus"]
* [required="required"] [disabled="disabled"] value="<value>" [checked="checked"] >
*
* @param array $formElement
...
...
@@ -633,23 +637,8 @@ class Checkbox {
* @throws \CodeException
* @throws \UserFormException
*/
public
function
constructCheckboxSinglePlain
(
array
$formElement
,
$htmlFormElementName
,
$attribute
,
$value
,
array
&
$json
)
{
public
function
constructCheckboxSinglePlain
(
array
$formElement
,
$htmlFormElementName
,
$attribute
,
$value
,
array
&
$json
,
$valueJson
)
{
$html
=
''
;
$valueJson
=
false
;
$attribute
.
=
Support
::
doAttribute
(
'id'
,
$formElement
[
FE_HTML_ID
]);
$attribute
.
=
Support
::
doAttribute
(
'name'
,
$htmlFormElementName
);
$attribute
.
=
Support
::
doAttribute
(
'value'
,
$formElement
[
FE_CHECKBOX_CHECKED
],
false
);
$attribute
.
=
Support
::
doAttribute
(
'data-load'
,
(
$formElement
[
FE_DYNAMIC_UPDATE
]
===
'yes'
)
?
'data-load'
:
''
);
$attribute
.
=
Support
::
doAttribute
(
ATTRIBUTE_DATA_REFERENCE
,
$formElement
[
FE_DATA_REFERENCE
]);
if
(
$formElement
[
FE_CHECKBOX_CHECKED
]
===
$value
)
{
$attribute
.
=
Support
::
doAttribute
(
'checked'
,
'checked'
);
$valueJson
=
$value
;
}
$attribute
.
=
HelperFormElement
::
getAttributeList
(
$formElement
,
[
'autofocus'
]);
$attribute
.
=
HelperFormElement
::
getAttributeList
(
$formElement
,
[
F_FE_DATA_PATTERN_ERROR
,
F_FE_DATA_REQUIRED_ERROR
,
F_FE_DATA_MATCH_ERROR
,
F_FE_DATA_ERROR
]);
$htmlHidden
=
HelperFormElement
::
buildNativeHidden
(
$htmlFormElementName
,
$formElement
[
FE_CHECKBOX_UNCHECKED
]);
$this
->
store
->
setVar
(
$htmlFormElementName
,
$htmlHidden
,
STORE_ADDITIONAL_FORM_ELEMENTS
,
false
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment