mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
Add Icon selection formBlock
This commit is contained in:
@@ -7,7 +7,11 @@
|
||||
|
||||
namespace Combodo\iTop\PropertyType\ValueType\Leaf;
|
||||
|
||||
use Combodo\iTop\DesignElement;
|
||||
use Combodo\iTop\Forms\Block\Base\ChoiceFormBlock;
|
||||
use Combodo\iTop\PropertyType\ValueType\Branch\AbstractBranchValueType;
|
||||
use Combodo\iTop\Service\DependencyInjection\ServiceLocator;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* @since 3.3.0
|
||||
@@ -18,4 +22,26 @@ class ValueTypeIcon extends AbstractLeafValueType
|
||||
{
|
||||
return ChoiceFormBlock::class;
|
||||
}
|
||||
|
||||
public function InitFromDomNode(DesignElement $oDomNode, ?AbstractBranchValueType $oParent = null): void
|
||||
{
|
||||
parent::InitFromDomNode($oDomNode, $oParent);
|
||||
|
||||
// Search icons in iTop and extensions
|
||||
/** @var \ModelReflection $oModelReflection */
|
||||
$oModelReflection = ServiceLocator::GetInstance()->get('ModelReflection');
|
||||
|
||||
$sChoices = "[\n";
|
||||
$aIcons = $oModelReflection->GetAvailableIcons();
|
||||
foreach ($aIcons as $aIcon) {
|
||||
$sValue = utils::QuoteForPHP($aIcon['label']);
|
||||
$sCode = utils::QuoteForPHP($aIcon['value']);
|
||||
$sChoices .= <<<PHP
|
||||
\t\t\t\t$sCode => $sValue,\n
|
||||
PHP;
|
||||
}
|
||||
$sChoices .= "\t\t\t]";
|
||||
|
||||
$this->aFormBlockOptionsForPHP['choices'] = $sChoices;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user