AnsPress_Form::add_default_in_field()

Description #

Add fields default values.

Source #

File: includes/class/form.php

	private function add_default_in_field() {
		if ( ! isset( $this->args['fields'] ) ) {
			return;
		}

		foreach ( (array) $this->args['fields'] as $k => $field ) {
			if ( ! is_array( $field ) ) {
				return;
			}

			$this->args['fields'][ $k ] = wp_parse_args( $field, array(
				'order'         => 10,
				'show_desc_tip' => false,
				'type'          => 'text',
			) );

			// Get value from opttions if options_form.
			if ( 'options_form' == $this->name && isset( $field['name'] ) && ! isset( $field['value'] ) ) {
				$this->args['fields'][ $k ]['value'] = ap_opt( $field['name'] );
			}
		}
	}

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