Commit 99a2d67b authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes #7864. 'required'-FE Elements, deactivated via...

Fixes #7864. 'required'-FE Elements, deactivated via formModeGlobal=requiredOff, now gets class 'required-field'. The final 'required' mode is still temporarily disabled.
parent 9dda4788
Pipeline #1507 passed with stage
in 2 minutes and 19 seconds
...@@ -833,7 +833,8 @@ abstract class AbstractBuildForm { ...@@ -833,7 +833,8 @@ abstract class AbstractBuildForm {
for ($i = 0; $i < count($this->feSpecNative); ++$i) { for ($i = 0; $i < count($this->feSpecNative); ++$i) {
// Only check native elements which will be shown // Only check native elements which will be shown
if ($this->feSpecNative[$i][FE_CLASS] == FE_CLASS_NATIVE && if ($this->feSpecNative[$i][FE_CLASS] == FE_CLASS_NATIVE &&
($this->feSpecNative[$i][FE_MODE] == FE_MODE_SHOW || $this->feSpecNative[$i][FE_MODE] == FE_MODE_REQUIRED) ($this->feSpecNative[$i][FE_MODE] == FE_MODE_SHOW || $this->feSpecNative[$i][FE_MODE] == FE_MODE_REQUIRED ||
$this->feSpecNative[$i][FE_MODE] == FE_MODE_SHOW_REQUIRED)
) { ) {
// Check if there is an explicit definition. // Check if there is an explicit definition.
if (isset($this->feSpecNative[$i][FE_AUTOFOCUS])) { if (isset($this->feSpecNative[$i][FE_AUTOFOCUS])) {
...@@ -991,7 +992,7 @@ abstract class AbstractBuildForm { ...@@ -991,7 +992,7 @@ abstract class AbstractBuildForm {
if (isset($formElement[FE_LABEL])) { if (isset($formElement[FE_LABEL])) {
$key = $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_LABEL; $key = $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_LABEL;
$addClass = ($formElement[FE_MODE] == FE_MODE_REQUIRED) ? CSS_REQUIRED : ''; $addClass = ($formElement[FE_MODE] == FE_MODE_REQUIRED || $formElement[FE_MODE] == FE_MODE_SHOW_REQUIRED) ? CSS_REQUIRED : '';
$json[API_ELEMENT_UPDATE][$key][API_ELEMENT_CONTENT] = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL], $addClass); $json[API_ELEMENT_UPDATE][$key][API_ELEMENT_CONTENT] = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL], $addClass);
} }
...@@ -1085,6 +1086,7 @@ abstract class AbstractBuildForm { ...@@ -1085,6 +1086,7 @@ abstract class AbstractBuildForm {
switch ($feMode) { switch ($feMode) {
case FE_MODE_SHOW: case FE_MODE_SHOW:
case FE_MODE_SHOW_REQUIRED:
break; break;
case FE_MODE_REQUIRED: case FE_MODE_REQUIRED:
$required = 'yes'; $required = 'yes';
...@@ -1494,6 +1496,7 @@ abstract class AbstractBuildForm { ...@@ -1494,6 +1496,7 @@ abstract class AbstractBuildForm {
switch ($feMode) { switch ($feMode) {
case FE_MODE_HIDDEN: case FE_MODE_HIDDEN:
case FE_MODE_SHOW: case FE_MODE_SHOW:
case FE_MODE_SHOW_REQUIRED:
break; break;
case FE_MODE_REQUIRED: case FE_MODE_REQUIRED:
case FE_MODE_READONLY: case FE_MODE_READONLY:
......
...@@ -741,7 +741,7 @@ EOF; ...@@ -741,7 +741,7 @@ EOF;
// Label // Label
if ($formElement[FE_BS_LABEL_COLUMNS] != '0') { if ($formElement[FE_BS_LABEL_COLUMNS] != '0') {
$addClass = ($formElement[FE_MODE] == FE_MODE_REQUIRED) ? CSS_REQUIRED : ''; $addClass = ($formElement[FE_MODE] == FE_MODE_REQUIRED || $formElement[FE_MODE] == FE_MODE_SHOW_REQUIRED) ? CSS_REQUIRED : '';
$htmlLabel = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL], $addClass); $htmlLabel = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL], $addClass);
} }
...@@ -808,7 +808,7 @@ EOF; ...@@ -808,7 +808,7 @@ EOF;
$wrapArray[0] = Support::insertAttribute($wrapArray[0], 'id', $htmlId); $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. $wrapArray[0] = Support::insertAttribute($wrapArray[0], 'class', $class); // might be problematic, if there is already a 'class' defined.
if ($wrapName == FE_WRAP_LABEL) { if ($wrapName == FE_WRAP_LABEL) {
$wrapArray[0] = Support::insertAttribute($wrapArray[0], 'style', 'text-align: ' . $formElement[F_FE_LABEL_ALIGN].';'); // might be problematic, if there is already a 'class' defined. $wrapArray[0] = Support::insertAttribute($wrapArray[0], 'style', 'text-align: ' . $formElement[F_FE_LABEL_ALIGN] . ';'); // might be problematic, if there is already a 'class' defined.
} }
} }
......
...@@ -988,6 +988,7 @@ const F_SHOW_ID_IN_FORM_TITLE = SYSTEM_SHOW_ID_IN_FORM_TITLE; ...@@ -988,6 +988,7 @@ const F_SHOW_ID_IN_FORM_TITLE = SYSTEM_SHOW_ID_IN_FORM_TITLE;
const FE_MODE_SHOW = 'show'; const FE_MODE_SHOW = 'show';
const FE_MODE_READONLY = 'readonly'; const FE_MODE_READONLY = 'readonly';
const FE_MODE_REQUIRED = 'required'; const FE_MODE_REQUIRED = 'required';
const FE_MODE_SHOW_REQUIRED = 'showRequired';
const FE_MODE_HIDDEN = 'hidden'; const FE_MODE_HIDDEN = 'hidden';
const FE_CLASS_NATIVE = 'native'; const FE_CLASS_NATIVE = 'native';
......
...@@ -388,7 +388,7 @@ EOF; ...@@ -388,7 +388,7 @@ EOF;
EOF; EOF;
} }
$skip = (!($formElement[FE_MODE] == FE_MODE_SHOW || $formElement[FE_MODE] == FE_MODE_REQUIRED)); $skip = (!($formElement[FE_MODE] == FE_MODE_SHOW || $formElement[FE_MODE] == FE_MODE_REQUIRED || $formElement[FE_MODE] == FE_MODE_SHOW_REQUIRED));
// LOCK // LOCK
if (!$skip && isset($formElement[FE_INPUT_EXTRA_BUTTON_LOCK])) { if (!$skip && isset($formElement[FE_INPUT_EXTRA_BUTTON_LOCK])) {
......
...@@ -1168,8 +1168,8 @@ class Support { ...@@ -1168,8 +1168,8 @@ class Support {
case FE_MODE_REQUIRED: case FE_MODE_REQUIRED:
if ($formMode == F_MODE_READONLY) { if ($formMode == F_MODE_READONLY) {
$feMode = FE_MODE_READONLY; $feMode = FE_MODE_READONLY;
} elseif ($formMode == F_MODE_REQUIRED_OFF && $feMode = FE_MODE_REQUIRED) { } elseif ($formMode == F_MODE_REQUIRED_OFF && $feMode == FE_MODE_REQUIRED) {
$feMode = FE_MODE_SHOW; $feMode = FE_MODE_SHOW_REQUIRED;
} }
break; break;
......
...@@ -278,6 +278,7 @@ class FillStoreForm { ...@@ -278,6 +278,7 @@ class FillStoreForm {
if ($formElement[FE_DYNAMIC_UPDATE] === 'yes' || if ($formElement[FE_DYNAMIC_UPDATE] === 'yes' ||
$formElement[FE_MODE] === FE_MODE_REQUIRED || $formElement[FE_MODE] === FE_MODE_REQUIRED ||
$formElement[FE_MODE] === FE_MODE_SHOW_REQUIRED ||
$formElement[FE_MODE] === FE_MODE_SHOW || $formElement[FE_MODE] === FE_MODE_SHOW ||
(isset($formElement[FE_PROCESS_READ_ONLY]) && $formElement[FE_PROCESS_READ_ONLY] != '0')) { (isset($formElement[FE_PROCESS_READ_ONLY]) && $formElement[FE_PROCESS_READ_ONLY] != '0')) {
......
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