Skip to content
GitLab
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
61aee0ae
Commit
61aee0ae
authored
Oct 29, 2018
by
Carsten Rose
Browse files
B3613 - revert broken fixes #3616 (Revision
0bb99fd1
, Revision
77096ca7
)
parent
a6622ff1
Pipeline
#1043
passed with stage
in 1 minute and 56 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/BuildFormBootstrap.php
View file @
61aee0ae
...
...
@@ -720,37 +720,41 @@ EOF;
$htmlLabel
=
$this
->
buildLabel
(
$htmlFormElementName
,
$formElement
[
FE_LABEL
],
$addClass
);
}
$html
.
=
$this
->
customWrap
(
$formElement
,
$htmlLabel
,
WRAP_SETUP_LABEL
,
FE_WRAP_LABEL
,
$formElement
[
FE_BS_LABEL_COLUMNS
],
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_LABEL
);
$html
.
=
$this
->
customWrap
(
$formElement
,
$htmlLabel
,
FE_WRAP_LABEL
,
$formElement
[
FE_BS_LABEL_COLUMNS
],
[
$this
->
wrap
[
WRAP_SETUP_LABEL
][
WRAP_SETUP_START
],
$this
->
wrap
[
WRAP_SETUP_LABEL
][
WRAP_SETUP_END
]],
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_LABEL
);
// Input
$html
.
=
$this
->
customWrap
(
$formElement
,
$htmlElement
,
WRAP_SETUP_INPUT
,
FE_WRAP_INPUT
,
$formElement
[
FE_BS_INPUT_COLUMNS
],
$html
.
=
$this
->
customWrap
(
$formElement
,
$htmlElement
,
FE_WRAP_INPUT
,
$formElement
[
FE_BS_INPUT_COLUMNS
],
[
$this
->
wrap
[
WRAP_SETUP_INPUT
][
WRAP_SETUP_START
],
$this
->
wrap
[
WRAP_SETUP_INPUT
][
WRAP_SETUP_END
]],
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_INPUT
,
$classHideElement
);
// Note
$note
=
$formElement
[
FE_NOTE
];
$html
.
=
$this
->
customWrap
(
$formElement
,
$note
,
WRAP_SETUP_NOTE
,
FE_WRAP_NOTE
,
$formElement
[
FE_BS_NOTE_COLUMNS
],
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_NOTE
);
$html
.
=
$this
->
customWrap
(
$formElement
,
$note
,
FE_WRAP_NOTE
,
$formElement
[
FE_BS_NOTE_COLUMNS
],
[
$this
->
wrap
[
WRAP_SETUP_NOTE
][
WRAP_SETUP_START
],
$this
->
wrap
[
WRAP_SETUP_NOTE
][
WRAP_SETUP_END
]],
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_NOTE
);
// Row
$html
=
$this
->
customWrap
(
$formElement
,
$html
,
WRAP_SETUP_ELEMENT
,
FE_WRAP_ROW
-
1
,
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_ROW
,
$classHideRow
);
$openTag
=
$formElement
[
FE_FLAG_ROW_OPEN_TAG
]
?
$this
->
getRowOpenTag
(
$classHideRow
)
:
''
;
$closeTag
=
$formElement
[
FE_FLAG_ROW_CLOSE_TAG
]
?
$this
->
wrap
[
WRAP_SETUP_ELEMENT
][
WRAP_SETUP_END
]
:
''
;
$html
=
$this
->
customWrap
(
$formElement
,
$html
,
FE_WRAP_ROW
,
-
1
,
[
$openTag
,
$closeTag
],
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_ROW
);
return
$html
;
}
/**
* Wrap content
as defined in this->wrap
or, if specified use $formElement[$wrapName]. Inject $htmlId in wrap.
* Wrap content
with $wrapArray
or, if specified use $formElement[$wrapName]. Inject $htmlId in wrap.
*
* Result:
* - if $bsColumns==0 and empty $formElement[$wrapName]: no wrap
* - if $formElement[$
customW
rapName] is given: wrap with that one.
* - if $htmlId is give
n
, inject it in $wrap.
* - if $formElement[$
w
rapName] is given: wrap with that one.
Else: wrap with $wrapArray
* - if $htmlId is give, inject it in $wrap.
*
* @param array $formElement Complete FormElement, especially some FE_WRAP
* @param string $htmlElement Content to wrap.
* @param string $wrapType WRAP_SETUP_ELEMENT, WRAP_SETUP_LABEL, WRAP_SETUP_INPUT, WRAP_SETUP_NOTE
* @param string $wrapName FE_WRAP_ROW, FE_WRAP_LABEL, FE_WRAP_INPUT, FE_WRAP_NOTE
* @param int $bsColumns
* @param array $wrapArray Systemwide Defaults: [ 'open wrap', 'close wrap' ]
* @param string $htmlId
* @param string $class
*
...
...
@@ -758,46 +762,29 @@ EOF;
* @throws CodeException
* @throws \qfq\UserFormException
*/
private
function
customWrap
(
array
$formElement
,
$htmlElement
,
$wrapType
,
$wrapName
,
$bsColumns
,
$htmlId
=
''
,
$class
=
''
)
{
$openTag
=
''
;
$closeTag
=
''
;
private
function
customWrap
(
array
$formElement
,
$htmlElement
,
$wrapName
,
$bsColumns
,
array
$wrapArray
,
$htmlId
=
''
,
$class
=
''
)
{
// If $bsColumns==0: do not wrap with default.
if
(
$bsColumns
!=
0
)
{
switch
(
$wrapType
)
{
case
WRAP_SETUP_ELEMENT
;
$openTag
=
$formElement
[
FE_FLAG_ROW_OPEN_TAG
]
?
$this
->
getRowOpenTag
(
$class
)
:
''
;
$closeTag
=
$formElement
[
FE_FLAG_ROW_CLOSE_TAG
]
?
$this
->
wrap
[
$wrapType
][
WRAP_SETUP_END
]
:
''
;
break
;
case
WRAP_SETUP_LABEL
:
case
WRAP_SETUP_INPUT
:
case
WRAP_SETUP_NOTE
:
$hasOpen
=
Support
::
findInSet
(
$wrapType
,
$formElement
[
FE_WRAP_ROW_LABEL_INPUT_NOTE
]);
$hasClose
=
Support
::
findInSet
(
"/
$wrapType
"
,
$formElement
[
FE_WRAP_ROW_LABEL_INPUT_NOTE
]);
$openTag
=
$hasOpen
?
$this
->
wrap
[
$wrapType
][
WRAP_SETUP_START
]
:
''
;
$closeTag
=
$hasClose
?
$this
->
wrap
[
$wrapType
][
WRAP_SETUP_END
]
:
''
;
break
;
default
:
throw
new
UserFormException
(
"Unknown wrap for FormElement.parameter '
$wrapType
'."
,
ERROR_MISSING_VALUE
);
break
;
}
if
(
$bsColumns
==
0
)
{
$wrapArray
[
0
]
=
''
;
$wrapArray
[
1
]
=
''
;
}
// If there is a 'per FormElement'-wrap, take it.
if
(
isset
(
$formElement
[
$wrapName
]))
{
$wrapArray
=
explode
(
'|'
,
$formElement
[
$wrapName
],
2
);
$openTag
=
$wrapArray
[
0
]
??
''
;
$closeTag
=
$wrapArray
[
1
]
??
''
;
}
if
(
$openTag
!=
''
)
{
$openTag
=
Support
::
insertAttribute
(
$openTag
,
'id'
,
$htmlId
);
$openTag
=
Support
::
insertAttribute
(
$openTag
,
'class'
,
$class
);
// might be problematic, if there is already a 'class' defined.
if
(
count
(
$wrapArray
)
!=
2
)
{
throw
new
UserFormException
(
"Need open & close wrap token for FormElement.parameter"
.
$wrapName
.
" - E.g.: <div ...>|</div>"
,
ERROR_MISSING_VALUE
);
}
if
(
$wrapArray
[
0
]
!=
''
)
{
$wrapArray
[
0
]
=
Support
::
insertAttribute
(
$wrapArray
[
0
],
'id'
,
$htmlId
);
$wrapArray
[
0
]
=
Support
::
insertAttribute
(
$wrapArray
[
0
],
'class'
,
$class
);
// might be problematic, if there is already a 'class' defined.
}
return
$
openTag
.
$htmlElement
.
$
closeTag
;
return
$
wrapArray
[
0
]
.
$htmlElement
.
$
wrapArray
[
1
]
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment