‪TYPO3CMS  ‪main
DropDownToggle.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 use TYPO3\CMS\Core\Imaging\IconSize;
21 
39 {
40  protected bool ‪$active = false;
41 
42  public function ‪isActive(): bool
43  {
44  return ‪$this->active;
45  }
46 
47  public function ‪setActive(bool ‪$active): self
48  {
49  $this->active = ‪$active;
50  return $this;
51  }
52 
53  public function ‪render(): string
54  {
55  // Status Icon
56  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
57  if ($this->‪isActive()) {
58  $statusIcon = '<span class="text-primary">' . $iconFactory->getIcon('actions-check', IconSize::SMALL)->render() . '</span>';
59  } else {
60  $statusIcon = $iconFactory->getIcon('empty-empty', IconSize::SMALL)->render();
61  }
62 
63  return '<' . $this->‪getTag() . ' ' . $this->‪getAttributesString() . '>'
64  . $statusIcon
65  . $this->‪getRenderedIcon()
66  . htmlspecialchars($this->‪getLabel())
67  . '</' . $this->‪getTag() . '>';
68  }
69 }
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\AbstractDropDownItem
Definition: AbstractDropDownItem.php:23
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\AbstractDropDownItem\getTag
‪getTag()
Definition: AbstractDropDownItem.php:37
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:34
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownToggle
Definition: DropDownToggle.php:39
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownToggle\isActive
‪isActive()
Definition: DropDownToggle.php:42
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\AbstractDropDownItem\getAttributesString
‪getAttributesString()
Definition: AbstractDropDownItem.php:114
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown
Definition: AbstractDropDownItem.php:16
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownItemInterface
Definition: DropDownItemInterface.php:19
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownToggle\render
‪render()
Definition: DropDownToggle.php:53
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\AbstractDropDownItem\getLabel
‪getLabel()
Definition: AbstractDropDownItem.php:54
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownToggle\$active
‪bool $active
Definition: DropDownToggle.php:40
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\AbstractDropDownItem\getRenderedIcon
‪getRenderedIcon()
Definition: AbstractDropDownItem.php:128
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownToggle\setActive
‪setActive(bool $active)
Definition: DropDownToggle.php:47
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52