Skip to content

Checkbox

Radoslav Georgiev edited this page Oct 21, 2018 · 2 revisions

Purpose

The checkbox field in Ultimate Fields displays an HTML checkbox field. You can enable the usage of custom CSS in order to stylize it.

checkbox-field

Options

Text

You can optionally enter text, which will be displayed next to the checkbox.

In PHP use the set_text( $text ) method to do it.

Field::create( 'checkbox', 'show_intro' )->set_text( 'Show' )

Fancy

You can "Enchance the field with CSS" for the checkbox field. This will add a toggle-like button with an obvious on-off indicator.

In PHP you can do this through the fancy method:

Field::create( 'checkbox', 'fancy_checkbox' )->fancy()

Usage

The value, which Ultimate FIelds returns for a checkbox field is always boolean, which means that you can use it for conditional statements without any additional checks.

<?php if( get_value( 'show_intro' ) ): ?>
  <div class="intro">
	<!-- Intro content here -->
  </div>
<?php endif; ?>
Clone this wiki locally