2 namespace wcf\system\form\builder\container\wysiwyg;
3 use wcf\data\smiley\SmileyCache;
4 use wcf\system\form\builder\container\FormContainer;
5 use wcf\system\form\builder\container\TabFormContainer;
6 use wcf\system\form\builder\container\TabTabMenuFormContainer;
7 use wcf\system\form\builder\wysiwyg\WysiwygSmileyFormNode;
8 use wcf\system\form\builder\TWysiwygFormNode;
9 use wcf\util\StringUtil;
12 * Represents the tab for the smiley-related fields below a WYSIWYG editor.
14 * @author Matthias Schmidt
15 * @copyright 2001-2019 WoltLab GmbH
16 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
17 * @package WoltLabSuite\Core\System\Form\Builder\Container\Wysiwyg
20 class WysiwygSmileyFormContainer extends TabTabMenuFormContainer {
24 * name of container template
27 protected $templateName = '__wysiwygSmileyFormContainer';
30 * Creates a new instance of `WysiwygSmileyFormContainer`.
32 public function __construct() {
33 $this->attribute('data-preselect', 'true')
34 ->attribute('data-collapsible', 'false')
41 public function populate() {
44 $smileyCategories = SmileyCache::getInstance()->getCategories();
46 foreach ($smileyCategories as $smileyCategory) {
47 $smileyCategory->loadSmilies();
48 if (count($smileyCategory) > 0) {
50 TabFormContainer::create($this->getId() . '_smileyCategoryTab' . $smileyCategory->categoryID)
51 ->label(StringUtil::encodeHTML($smileyCategory->getTitle()))
52 ->removeClass('tabMenuContent')
53 ->addClass('messageTabMenuContent')
55 FormContainer::create($this->getId() . '_smileyCategoryContainer' . $smileyCategory->categoryID)
56 ->removeClass('section')
58 WysiwygSmileyFormNode::create($this->getId() . '_smileyCategory' . $smileyCategory->categoryID)
59 ->smilies(SmileyCache::getInstance()->getCategorySmilies($smileyCategory->categoryID ?: null))
66 if (count($this->children()) > 1) {
67 $this->addClass('messageTabMenu');