componentFactory->createDropDownRadio() * ->setHref('#') * ->setActive(true) * ->setLabel('List') * ->setTitle('List') * ->setIcon($this->iconFactory->getIcon('actions-viewmode-list')) * ->setAttributes(['data-type' => 'list']); * $dropDownButton->addItem($item); * * $item = $this->componentFactory->createDropDownRadio() * ->setHref('#') * ->setActive(false) * ->setLabel('Tiles') * ->setTitle('Tiles') * ->setIcon($this->iconFactory->getIcon('actions-viewmode-tiles')) * ->setAttributes(['data-type' => 'tiles']); * $dropDownButton->addItem($item); * ``` */ class DropDownRadio extends AbstractDropDownItem implements DropDownItemInterface { public function render(): string { $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $statusIcon = $this->isActive() ? '' . $iconFactory->getIcon('actions-dot', IconSize::SMALL)->render() . '' : $iconFactory->getIcon('empty-empty', IconSize::SMALL)->render(); return sprintf( '<%1$s %2$s>%3$s%4$s%5$s', $this->getTag(), $this->getAttributesString(), $statusIcon, $this->getRenderedIcon(), htmlspecialchars($this->getLabel()) ); } }