Checkbox::prepare()

Description #

Prepare field.

Source #

File: lib/form/class-checkbox.php

	protected function prepare() {
		$this->args = wp_parse_args(
			$this->args,
			array(
				'label' => __( 'AnsPress Checkbox Field', 'anspress-question-answer' ),
			)
		);

		// Call parent prepare().
		parent::prepare();

		// Make sure checkbox value are sanitized.
		if ( $this->get( 'options' ) ) {
			$this->sanitize_cb = array_merge( array( 'array_remove_empty', 'text_field' ), $this->sanitize_cb );
		} else {
			$this->sanitize_cb = array_merge( array( 'boolean' ), $this->sanitize_cb );
		}
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment