Checkboxes

This field type renders multiple checkboxes.

Parameters

Parameters are inherited from the Select field type, but multiple is always set to true.

Example

The code below renders a field with the custom_field name, "Custom field" label and three checkboxes, requiring at least one option to be checked.

echo ( new HivePress\Fields\Checkboxes(
	[
		'name'     => 'custom_field',
		'label'    => 'Custom field',
		'required' => true,

		'options'  => [
			'one'   => 'One',
			'two'   => 'Two',
			'three' => 'Three',
		],
	]
) )->render();

Last updated