Hosting Handler

getAvailableProductOptions()

Signature

public function getAvailableProductOptions(): array

Description

Defines all configurations the admin can configure. They can later be used e.g. in the create() method

Basically this method returns a key-value array where the key is the technical name of the option and the value is an instance of ProductOptionField().

Field types

hostware options support text, number, dropdown and boolean options. In the next section you learn how to configure them.

Example

Every field after the display name is 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.
	),
];
Was this helpful?