aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/LinkButton.class.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2022-10-17 14:50:20 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2022-10-17 14:50:20 +0000
commit4695506d9ea6d0dce90e16f12ae0bb215ce1a01b (patch)
treea5735282a9fa4f1a5f7112608f5b3310584eb16a /lib/classes/LinkButton.class.php
parent169c42d48f6c9a3e9981dea4713ba0b9176dd41e (diff)
fix php8 warnings, fixes #1679
Closes #1679 Merge request studip/studip!1084
Diffstat (limited to 'lib/classes/LinkButton.class.php')
-rw-r--r--lib/classes/LinkButton.class.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/classes/LinkButton.class.php b/lib/classes/LinkButton.class.php
index 6d60da8..f203841 100644
--- a/lib/classes/LinkButton.class.php
+++ b/lib/classes/LinkButton.class.php
@@ -36,17 +36,16 @@ class LinkButton extends Interactable
public function __toString()
{
// add "button" to attribute @class
- $this->attributes['class'] .= ' button';
-
- $attributes = [];
- ksort($this->attributes);
- foreach ($this->attributes as $k => $v) {
- $attributes[] = sprintf(' %s="%s"', $k, htmlReady($v));
+ if (!isset($this->attributes['class'])) {
+ $this->attributes['class'] = '';
}
+ $this->attributes['class'] .= ' button';
// TODO: URLHelper...?!
- return sprintf('<a%s>%s</a>',
- join('', $attributes),
- htmlReady($this->label));
+ return sprintf(
+ '<a %s>%s</a>',
+ arrayToHtmlAttributes($this->attributes),
+ htmlReady($this->label)
+ );
}
}