Hosting-Handler

getAvailableProductOptions()

Signatur

public function getAvailableProductOptions(): array

Beschreibung

Definiert alle Konfigurationen, die der Admin festlegen kann. Sie können später z. B. in der Methode create() verwendet werden

Im Grunde gibt diese Methode ein Key-Value-Array zurück, wobei der Schlüssel der technische Name der Option und der Wert eine Instanz von ProductOptionField() ist.

Feldtypen

hostware-Optionen unterstützen Text-, Zahlen-, Dropdown- und Boolesche-Optionen. Im nächsten Abschnitt lernst Du, wie Du sie konfigurierst.

Beispiel

Jedes Feld nach dem Anzeigenamen ist optional.

return [
	// Use the technical name, which can later be used to retrieve the value, as key
	"virtualization" => new ProductOptionField(
		ProductOptionFieldEnum::DROPDOWN, // The type of the field
		"Virtualization",                 // The displayed name in the administration (should be english)
		null,                             // The optionally displayed description in the administration (should be english)
		"qemu",                           // The default value
		[                                 // The dropdown key-value array, where the value is the label in the administration
			'qemu' => 'KVM',
			'lxc' => 'LXC',
		],
		true                               // Set to true if this option can only be configured via product option. Use-case are e.g. fields for the products hostname.
	),
];
War das hilfreich?