Select::field_markup()

Description #

Field markup.

Source #

File: lib/form/class-select.php

	public function field_markup() {
		parent::field_markup();

		$this->add_html( '<select' . $this->common_attr() . $this->custom_attr() . '>' );
		$this->add_html( '<option value="">' . __( 'Select an option', 'anspress-question-answer' ) . '</option>' );

		foreach ( (array) $this->get_options() as $val => $label ) {
			$selected = selected( $this->value(), $val, false );
			$this->add_html( '<option value="' . esc_attr( $val ) . '" ' . $selected . '>' . esc_html( $label ) . '</option>' );
		}

		$this->add_html( '</select>' );

		/** This action is documented in lib/form/class-input.php */
		do_action_ref_array( 'ap_after_field_markup', array( &$this ) );
	}

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