‪TYPO3CMS  ‪main
DropDownRadio.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 
54 {
55  protected bool ‪$active = false;
56 
57  public function ‪isActive(): bool
58  {
59  return ‪$this->active;
60  }
61 
62  public function ‪setActive(bool ‪$active): self
63  {
64  $this->active = ‪$active;
65  return $this;
66  }
67 
68  public function ‪render(): string
69  {
70  // Status Icon
71  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
72  if ($this->‪isActive()) {
73  $statusIcon = '<span class="text-primary">' . $iconFactory->getIcon('actions-dot', IconSize::SMALL)->render() . '</span>';
74  } else {
75  $statusIcon = $iconFactory->getIcon('empty-empty', IconSize::SMALL)->render();
76  }
77 
78  return '<' . $this->‪getTag() . ' ' . $this->‪getAttributesString() . '>'
79  . $statusIcon
80  . $this->‪getRenderedIcon()
81  . htmlspecialchars($this->‪getLabel())
82  . '</' . $this->‪getTag() . '>';
83  }
84 }
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\AbstractDropDownItem
Definition: AbstractDropDownItem.php:23
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownRadio\render
‪render()
Definition: DropDownRadio.php:68
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\AbstractDropDownItem\getTag
‪getTag()
Definition: AbstractDropDownItem.php:37
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownRadio\$active
‪bool $active
Definition: DropDownRadio.php:55
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:34
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownRadio\isActive
‪isActive()
Definition: DropDownRadio.php:57
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownRadio\setActive
‪setActive(bool $active)
Definition: DropDownRadio.php:62
‪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\DropDownRadio
Definition: DropDownRadio.php:54
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\DropDownItemInterface
Definition: DropDownItemInterface.php:19
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\AbstractDropDownItem\getLabel
‪getLabel()
Definition: AbstractDropDownItem.php:54
‪TYPO3\CMS\Backend\Template\Components\Buttons\DropDown\AbstractDropDownItem\getRenderedIcon
‪getRenderedIcon()
Definition: AbstractDropDownItem.php:128
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52