Commit 46879622 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Bug #3890 / upload-FormElement: mode 'hide' without effect

Next result of migration FE.mode='hide' from 'form-update' to 'element-update'. Fixed
BuildFormBootstrap: new function getRowOpenTag(). Preparation to support show/hide in single row on multiple elements.
parent 8faeaf13
......@@ -70,6 +70,16 @@ class BuildFormBootstrap extends AbstractBuildForm {
// $this->feDivClass['checkbox'] = 'checkbox';
}
/**
* @param string $addClass
* @return string
*/
public function getRowOpenTag($addClass = '') {
$class = Support::doAttribute('class', [$this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_CLASS], $addClass]);
return "<div $class>";
}
/**
* @param $label
* @param $input
......@@ -510,6 +520,10 @@ EOF;
public function buildRowNative(array $formElement, $htmlElement, $htmlFormElementName) {
$html = '';
$htmlLabel = '';
$addClass = '';
$flagRowOpenTag = Support::findInSet('row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$flagRowCloseTag = Support::findInSet('/row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
// Label
if ($formElement[FE_BS_LABEL_COLUMNS] > 0) {
......@@ -528,15 +542,26 @@ EOF;
$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
$openTag = (Support::findInSet('row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOW])) ? $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_START] : '';
$closeTag = (Support::findInSet('/row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOW])) ? $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_END] : '';
$html = $this->customWrap($formElement, $html, FE_WRAP_ROW, 99, [$openTag, $closeTag], $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_ROW);
if ($formElement[FE_MODE] == FE_MODE_HIDDEN) {
$addClass = 'hidden';
}
// Row
$openTag = $flagRowOpenTag ? $this->getRowOpenTag($addClass) : '';
$closeTag = $flagRowCloseTag ? $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 with $wrapArray or, if specified use $formElement[$wrapName]. Inject $htmlId in wrap.
*
* Result:
* - if $bsColumns==0 and empty $formElement[$wrapName]: no wrap
* - if $formElement[$wrapName] 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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment