Commit 1a0d5d36 authored by Carsten  Rose's avatar Carsten Rose
Browse files

#3773 / Button: Info / Unlock / ShowPassword

Add extraText to 'textarea' elements. Still some issues open.
parent e338a187
......@@ -894,7 +894,10 @@ abstract class AbstractBuildForm {
// Check for input type 'textarea'.
$colsRows = explode(',', $formElement['size'], 2);
if (count($colsRows) === 2) {
$inputTypeTextarea = (count($colsRows) === 2);
$formElement = $this->inputExtraButton($formElement, $inputTypeTextarea, $extraButton);
if ($inputTypeTextarea) {
// <textarea>
$htmlTag = '<textarea';
......@@ -903,7 +906,6 @@ abstract class AbstractBuildForm {
$textarea = htmlentities($value) . '</textarea>';
} else {
$formElement = $this->inputExtraButton($formElement, $extraButton);
$htmlTag = '<input';
$attribute .= $this->getAttributeList($formElement, ['type', 'size']);
$attribute .= Support::doAttribute('value', htmlentities($value), false);
......@@ -922,7 +924,13 @@ abstract class AbstractBuildForm {
$input = "$htmlTag $attribute>$textarea";
if ($extraButton !== '') {
$input = Support::wrapTag('<div class="input-group">', $input . $extraButton);
if ($inputTypeTextarea) {
$input .= $extraButton;
} else {
$input = Support::wrapTag('<div class="input-group">', $input . $extraButton);
}
if (!empty($formElement[FE_INPUT_EXTRA_BUTTON_INFO])) {
$input .= $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
}
......@@ -934,10 +942,11 @@ abstract class AbstractBuildForm {
/**
* @param array $formElement
* @param $rcExtraButton
* @param bool $inputTypeTextarea
* @param string $rcExtraButton
* @return array
*/
private function inputExtraButton(array $formElement, &$rcExtraButton) {
private function inputExtraButton(array $formElement, $inputTypeTextarea, &$rcExtraButton) {
if (!($formElement[FE_MODE] == FE_MODE_SHOW || $formElement[FE_MODE] == FE_MODE_REQUIRED)) {
return $formElement;
......@@ -976,8 +985,8 @@ EOF;
EOF;
}
// INFO
if (isset($formElement[FE_INPUT_EXTRA_BUTTON_INFO])) {
// INFO: regular 'input'
if (isset($formElement[FE_INPUT_EXTRA_BUTTON_INFO]) && !$inputTypeTextarea) {
$rcExtraButton .= <<<EOF
<div class="input-group-btn">
<button class="btn btn-info" onclick="$('#$id-extra-info').slideToggle('swing')">
......@@ -985,6 +994,7 @@ EOF;
</button>
</div>
EOF;
$value = $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
$formElement[FE_INPUT_EXTRA_BUTTON_INFO] = <<<EOF
<div class="alert alert-info qfq-margin-top" id="$id-extra-info" style="display: none;">
......@@ -993,6 +1003,20 @@ EOF;
EOF;
}
// INFO: 'textarea'
if (isset($formElement[FE_INPUT_EXTRA_BUTTON_INFO]) && $inputTypeTextarea) {
$rcExtraButton .= <<<EOF
<span class="glyphicon glyphicon-info-sign text-info qfq-icon-inside" aria-hidden="true" onclick="$('#$id-extra-info').slideToggle('swing')"></span>
EOF;
$value = $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
$formElement[FE_INPUT_EXTRA_BUTTON_INFO] = <<<EOF
<div class="alert alert-info" id="$id-extra-info" style="display: none;">
<p>$value</p>
</div>
EOF;
}
return $formElement;
}
......
Supports Markdown
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