Commit 989ff133 authored by Elias Villiger's avatar Elias Villiger
Browse files

Merge branch '6300-preview-button-disabled' into 'master'

Feature #6300 - Disable preview button for requiredNew forms

See merge request !74
parents 3fb93486 496cf362
Pipeline #879 passed with stage
in 1 minute and 45 seconds
......@@ -252,17 +252,22 @@ class BuildFormBootstrap extends AbstractBuildForm {
$toolTip = "Form not 'form' or 'formElement'";
$status = 'disabled';
} else {
$queryStringArray = [
'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM),
'form' => $form,
'r' => 0,
];
$queryString = Support::arrayToQueryString($queryStringArray);
$sip = $this->store->getSipInstance();
$url = $sip->queryStringToSip($queryString);
$toolTip = "View current form with r=0" . PHP_EOL . PHP_EOL . OnArray::toString($queryStringArray, ' = ', PHP_EOL, "'");
$requiredNew = $this->store->getVar(F_REQUIRED_PARAMETER_NEW, STORE_RECORD . STORE_EMPTY);
if (trim($requiredNew) !== '') {
$toolTip = "Form has 'required new' parameters and therefore cannot be previewed.";
$status = 'disabled';
} else {
$queryStringArray = [
'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM),
'form' => $form,
'r' => 0,
];
$queryString = Support::arrayToQueryString($queryStringArray);
$sip = $this->store->getSipInstance();
$url = $sip->queryStringToSip($queryString);
$toolTip = "View current form with r=0" . PHP_EOL . PHP_EOL . OnArray::toString($queryStringArray, ' = ', PHP_EOL, "'");
}
}
return $this->buildButtonAnchor($url, 'form-view-' . $this->formSpec[F_ID], '', $toolTip, GLYPH_ICON_VIEW, $status, 'btn btn-default navbar-btn');
......@@ -378,7 +383,10 @@ class BuildFormBootstrap extends AbstractBuildForm {
$attribute .= Support::doAttribute('class', "$class $disabled");
$attribute .= Support::doAttribute('title', $toolTip);
return Support::wrapTag("<a $attribute>", $element);
// disabled links do not show tooltips -> use a span
$wrapTag = $disabled == 'disabled' ? 'span' : 'a';
return Support::wrapTag("<$wrapTag $attribute>", $element);
}
/**
......
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