Enhance Service locator

This commit is contained in:
Eric Espie
2026-01-27 11:54:05 +01:00
parent 390b5c0bc3
commit bfa7a209d6
43 changed files with 338 additions and 210 deletions

View File

@@ -6,13 +6,22 @@ use Combodo\iTop\Forms\Block\Base\ChoiceFormBlock;
use Combodo\iTop\Forms\Block\Base\FormBlock;
use Combodo\iTop\Forms\Block\Base\IntegerFormBlock;
use Combodo\iTop\PropertyType\PropertyTypeService;
use MetaModel;
class DashletFormBlock extends FormBlock
{
private PropertyTypeService $oPropertyTypeService;
public function __construct(string $sName, array $aOptions = [])
{
parent::__construct($sName, $aOptions);
$this->oPropertyTypeService = MetaModel::GetService('PropertyTypeService');
}
protected function BuildForm(): void
{
// type
$aPropertyTypes = PropertyTypeService::GetInstance()->ListPropertyTypesByType('Dashlet');
$aPropertyTypes = $this->oPropertyTypeService->ListPropertyTypesByType('Dashlet');
$this->Add('class', ChoiceFormBlock::class, [
'label' => 'Class',
'choices' => array_combine($aPropertyTypes, $aPropertyTypes),