wordpress/wp-content/themes/basic/themify/themify-metabox/includes/themify-field-types.php
/**
 * Generates checkbox field
 *
 * @param array $args Field settings
 *
 * @since 1.3.2
 * @return string
 */
Generates checkbox field
@param array $args Field settings


Generates checkbox field @param array $args Field settings
function themify_meta_field_checkbox( $args ) {
	$meta_box = $args['meta_box'];
	$meta_value = $args['meta_value'];
	extract($args, EXTR_OVERWRITE);
	$checked = $meta_value || ( isset( $meta_box['default'] ) && 'checked' === $meta_box['default'] && 'auto-draft' === get_post_status() ) ? 'checked="checked"' : '';
	$html = sprintf('<input type="checkbox" id="%s" name="%s" %s class="%s" data-val="%s" />',
		esc_attr( $meta_box['name'] ), esc_attr( $meta_box['name'] ), $checked, esc_attr( $meta_box['name'] ).'-toggle-control', esc_attr( $meta_box['name'] ));
	if ( isset( $meta_box['label'] ) && '' != $meta_box['label'] ) {
		$html = sprintf( '<label for="%s">%s %s</label>', esc_attr( $meta_box['name'] ), $html, esc_attr( $meta_box['label'] ) );
	}
	if ( isset( $meta_box['description'] ) ) {
		$html .= themify_meta_field_get_description( $meta_box['description'] );
	}
	if( isset( $meta_box['before'] ) && $meta_box['before'] ) $html = $meta_box['before'] . $html;
	if( isset( $meta_box['after'] ) && $meta_box['after'] )  $html .= $meta_box['after'];
	echo $html;
}
function themify_meta_field_checkbox ( $ args ) { $ meta_box = $ args [ 'meta_box' ] ; $ meta_value = $ args [ 'meta_value' ] ; extract ( $ args , EXTR_OVERWRITE ) ; $ checked = $ meta_value || ( isset ( $ meta_box [ 'default' ] ) && 'checked' === $ meta_box [ 'default' ] && 'auto-draft' === get_post_status ( ) ) ? 'checked="checked"' : '' ; $ html = sprintf ( '<input type="checkbox" id="%s" name="%s" %s class="%s" data-val="%s" />' , esc_attr ( $ meta_box [ 'name' ] ) , esc_attr ( $ meta_box [ 'name' ] ) , $ checked , esc_attr ( $ meta_box [ 'name' ] ) . '-toggle-control' , esc_attr ( $ meta_box [ 'name' ] ) ) ; if ( isset ( $ meta_box [ 'label' ] ) && '' != $ meta_box [ 'label' ] ) { $ html = sprintf ( '<label for="%s">%s %s</label>' , esc_attr ( $ meta_box [ 'name' ] ) , $ html , esc_attr ( $ meta_box [ 'label' ] ) ) ; } if ( isset ( $ meta_box [ 'description' ] ) ) { $ html .= themify_meta_field_get_description ( $ meta_box [ 'description' ] ) ; } if ( isset ( $ meta_box [ 'before' ] ) && $ meta_box [ 'before' ] ) $ html = $ meta_box [ 'before' ] . $ html ; if ( isset ( $ meta_box [ 'after' ] ) && $ meta_box [ 'after' ] ) $ html .= $ meta_box [ 'after' ] ; echo $ html ; }
Generates checkbox field
 @param array $args Field settings
Generates checkbox field @param array $args Field settings