Checkbox

This field type renders a checkbox.

Parameters

  • caption - text displayed next to the checkbox;

  • check_value - value considered as "checked" (true by default).

Example

The code below renders a required checkbox field with the custom_field name, "Custom field" label and "Custom text" caption.

echo ( new HivePress\Fields\Checkbox(
	[
		'name'     => 'custom_field',
		'label'    => 'Custom field',
		'caption'  => 'Custom text',
		'required' => true,
	]
) )->render();

Last updated