Skip to content

Commit 88acdb6

Browse files
committed
Use FontAwesomeIcon instead of a string
1 parent b098421 commit 88acdb6

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

com.woltlab.wcf/templates/shared_wysiwygTabMenuFormContainer.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{if $child->isAvailable()}
99
<li data-name="{$child->getName()}"{if !$child->checkDependencies()} hidden{/if}>
1010
<button type="button">
11-
{if $child->getIcon()}{icon name=$child->getIcon()}{/if}
11+
{if $child->getIcon()}{unsafe:$child->getIcon()->toHtml()}{/if}
1212
<span>{@$child->getLabel()}</span>
1313
</button>
1414
</li>

wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/IWysiwygTabFormContainer.class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace wcf\system\form\builder\container\wysiwyg;
44

55
use wcf\system\form\builder\container\IFormContainer;
6+
use wcf\system\style\FontAwesomeIcon;
67

78
/**
89
* Represents a container that is a tab of a wysiwyg tab menu.
@@ -17,7 +18,7 @@ interface IWysiwygTabFormContainer extends IFormContainer
1718
/**
1819
* Gets the icon associated with the tab.
1920
*/
20-
public function getIcon(): ?string;
21+
public function getIcon(): ?FontAwesomeIcon;
2122

2223
/**
2324
* Gets the name associated with the tab.

wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygFormContainer.class.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use wcf\system\form\builder\field\wysiwyg\WysiwygFormField;
1515
use wcf\system\form\builder\IFormChildNode;
1616
use wcf\system\form\builder\TWysiwygFormNode;
17+
use wcf\system\style\FontAwesomeIcon;
1718

1819
/**
1920
* Represents the whole container with a WYSIWYG editor and the associated tab menu below it with
@@ -505,7 +506,7 @@ public function populate()
505506
->addClass('formAttachmentContent')
506507
->label('wcf.attachment.attachments')
507508
->name("attachments")
508-
->icon('paperclip')
509+
->icon(FontAwesomeIcon::fromValues('paperclip'))
509510
->wysiwygId($this->getWysiwygId())
510511
->appendChild(
511512
FormContainer::create($this->wysiwygId . 'AttachmentsContainer')
@@ -514,14 +515,14 @@ public function populate()
514515

515516
WysiwygTabFormContainer::create($this->wysiwygId . 'SettingsTab')
516517
->label('wcf.message.settings')
517-
->icon('gear')
518+
->icon(FontAwesomeIcon::fromValues('gear'))
518519
->name('settings')
519520
->wysiwygId($this->getWysiwygId())
520521
->appendChild($this->settingsContainer),
521522

522523
WysiwygTabFormContainer::create($this->wysiwygId . 'PollTab')
523524
->label('wcf.poll.management')
524-
->icon('chart-bar')
525+
->icon(FontAwesomeIcon::fromValues('chart-bar'))
525526
->name('poll')
526527
->wysiwygId($this->getWysiwygId())
527528
->appendChild($this->pollContainer),

wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygQuoteFormContainer.class.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace wcf\system\form\builder\container\wysiwyg;
44

5+
use wcf\system\style\FontAwesomeIcon;
6+
57
/**
68
* Represents the form container for the quote-related fields below a WYSIWYG editor.
79
*
@@ -16,7 +18,7 @@ class WysiwygQuoteFormContainer extends WysiwygTabFormContainer
1618

1719
public function __construct()
1820
{
19-
$this->icon('quote-left')
21+
$this->icon(FontAwesomeIcon::fromValues('quote-left'))
2022
->name('quotes')
2123
->label('wcf.bbcode.quote');
2224
}

wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygSmileyFormContainer.class.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use wcf\system\form\builder\container\TabTabMenuFormContainer;
99
use wcf\system\form\builder\TWysiwygFormNode;
1010
use wcf\system\form\builder\wysiwyg\WysiwygSmileyFormNode;
11+
use wcf\system\style\FontAwesomeIcon;
1112
use wcf\util\StringUtil;
1213

1314
/**
@@ -78,9 +79,9 @@ public function populate()
7879
}
7980

8081
#[\Override]
81-
public function getIcon(): string
82+
public function getIcon(): ?FontAwesomeIcon
8283
{
83-
return 'face-smile';
84+
return FontAwesomeIcon::fromValues('face-smile');
8485
}
8586

8687
#[\Override]

wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygTabFormContainer.class.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use wcf\system\form\builder\container\TabFormContainer;
66
use wcf\system\form\builder\TWysiwygFormNode;
7+
use wcf\system\style\FontAwesomeIcon;
78

89
/**
910
* Represents a container that is a tab of a wysiwyg tab menu.
@@ -22,19 +23,19 @@ class WysiwygTabFormContainer extends TabFormContainer implements IWysiwygTabFor
2223
*/
2324
protected $templateName = 'shared_wysiwygTabFormContainer';
2425

25-
protected ?string $icon = null;
26+
protected ?FontAwesomeIcon $icon = null;
2627
protected string $name = '';
2728

2829
#[\Override]
29-
public function getIcon(): ?string
30+
public function getIcon(): ?FontAwesomeIcon
3031
{
3132
return $this->icon;
3233
}
3334

3435
/**
3536
* Sets the icon associated with the tab.
3637
*/
37-
public function icon(?string $icon): static
38+
public function icon(?FontAwesomeIcon $icon): static
3839
{
3940
$this->icon = $icon;
4041

0 commit comments

Comments
 (0)