AnsPress_Form::form_head()

Description #

FORM element.

Changelog #

VersionDescription
2.0.1Introduced.

Source #

File: includes/class/form.php

	private function form_head() {

		$attr = '';

		if ( ! empty( $this->args['attr'] ) ) {
			$attr .= $this->args['attr'];
		}

		if ( $this->args['is_ajaxified'] ) {
			$attr .= ' data-action="ap_ajax_form"';
		}

		if ( ! empty( $this->args['class'] ) ) {
			$attr .= ' class="' . $this->args['class'] . '"';
		}

		ob_start();

		/**
		 * ACTION: ap_form_before_[form_name]
		 * action for hooking before form.
		 *
		 * @since 2.0.1
		 */
		do_action( 'ap_form_before_' . $this->name );

		$this->output .= ob_get_clean();

		// Add enctype if form is multipart.
		$multipart = $this->args['multipart'] ? ' enctype="multipart/form-data"' : '';
		if ( ! isset( $this->args['hide_footer'] ) || false !== $this->args['hide_footer'] ) {
			$this->output .= '<form name="' . $this->args['name'] . '" id="' . $this->args['name'] . '" method="' . $this->args['method'] . '" action="' . $this->args['action'] . '"' . $attr . $multipart . '>';
		}
	}

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