Field::errors()

Description #

Output label of field.

Source #

File: lib/form/class-field.php

	public function errors() {
		$wrapper = $this->get( 'wrapper', array() );

		if ( false !== $wrapper ) {
			$this->add_html( '<div class="ap-field-errorsc">' );
		}

		if ( $this->have_errors() ) {
			$this->add_html( '<div class="ap-field-errors">' );
			foreach ( $this->errors as $code => $err ) {
				$this->add_html( '<span class="ap-field-error ecode-' . esc_attr( $code ) . '">' . esc_html( $err ) . '</span>' );
			}
			$this->add_html( '</div>' );
		}

		if ( false !== $wrapper ) {
			$this->add_html( '</div>' );
		}
	}

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