mirror of
https://github.com/Icinga/icingaweb2.git
synced 2026-06-10 09:01:04 -04:00
Use array for class list
This commit is contained in:
parent
ceeeee3447
commit
4bc4dc339b
1 changed files with 15 additions and 6 deletions
|
|
@ -137,11 +137,15 @@ class CspConfigForm extends CompatForm
|
|||
);
|
||||
|
||||
$disabledState = $this->getPopulatedValue('use_custom_csp') === '1';
|
||||
$disabledClass = $disabledState ? 'csp-disabled' : '';
|
||||
|
||||
$formHintClassList = ['csp-form-hint'];
|
||||
if ($disabledState) {
|
||||
$formHintClassList[] = 'csp-disabled';
|
||||
}
|
||||
|
||||
$this->add(HtmlElement::create(
|
||||
'p',
|
||||
['class' => ['csp-form-hint', $disabledClass]],
|
||||
['class' => $formHintClassList],
|
||||
$this->translate(
|
||||
'Enabling CSP will block some requests and prevent some functionality from working as expected.'
|
||||
),
|
||||
|
|
@ -156,13 +160,13 @@ class CspConfigForm extends CompatForm
|
|||
} else {
|
||||
$this->add(HtmlElement::create(
|
||||
'h3',
|
||||
['class' => ['csp-form-hint', $disabledClass]],
|
||||
['class' => $formHintClassList],
|
||||
$this->translate('Allowed Sources'),
|
||||
));
|
||||
|
||||
$this->add(HtmlElement::create(
|
||||
'p',
|
||||
['class' => ['csp-form-hint', $disabledClass]],
|
||||
['class' => $formHintClassList],
|
||||
$this->translate(
|
||||
'Sources that are used in the generation of the CSP-Header.'
|
||||
),
|
||||
|
|
@ -170,7 +174,7 @@ class CspConfigForm extends CompatForm
|
|||
|
||||
$this->add(HtmlElement::create(
|
||||
'h4',
|
||||
['class' => "csp-form-hint $disabledClass"],
|
||||
['class' => $formHintClassList],
|
||||
$this->translate('System'),
|
||||
));
|
||||
|
||||
|
|
@ -468,8 +472,13 @@ class CspConfigForm extends CompatForm
|
|||
return;
|
||||
}
|
||||
|
||||
$classList = ['csp-config-table'];
|
||||
if (! $enabled) {
|
||||
$classList[] = 'csp-disabled';
|
||||
}
|
||||
|
||||
$table = new Table();
|
||||
$table->addAttributes(Attributes::create(['class' => ['csp-config-table', $enabled ? '' : 'csp-disabled']]));
|
||||
$table->addAttributes(Attributes::create(['class' => $classList]));
|
||||
$headerRow = Table::tr();
|
||||
foreach ($header as $h) {
|
||||
$headerRow->add(Table::th($h));
|
||||
|
|
|
|||
Loading…
Reference in a new issue