LLMS_Form_Field::get_html()

Retrieve the field’s HTML.


Return Return

(string)


Top ↑

Source Source

File: includes/forms/class-llms-form-field.php

	public function get_html() {

		/**
		 * Short-circuit field HTML generation.
		 *
		 * Allows a 3rd party to replace the HTML generation method with entirely custom HTML
		 * by returning a non-null value.
		 *
		 * @since 5.0.0
		 *
		 * @param string          $pre       The pre-rendered HTML content. Default `null`.
		 * @param array           $settings  The prepared field settings array.
		 * @param LLMS_Form_Field $field_obj Form field instance.
		 */
		$pre = apply_filters( 'llms_form_field_pre_render', null, $this->settings, $this );
		if ( ! is_null( $pre ) ) {
			return $pre;
		}

		$before = '';
		$after  = '';

		if ( 'hidden' !== $this->settings['type'] ) {

			$before .= sprintf( '<div class="%s">', implode( ' ', $this->settings['wrapper_classes'] ) );

			$label_pos   = $this->get_label_position();
			$$label_pos .= $this->get_label_html();

			$desc = $this->get_description_html();

			if ( $this->is_input_group() ) {
				$before .= $desc;
			} else {
				$after .= $this->get_description_html();
			}

			$after .= '</div>';

			if ( $this->settings['last_column'] ) {
				$after .= '<div class="clear"></div>';
			}
		}

		$this->html = $before . $this->get_field_html() . $after;

		return apply_filters( 'llms_form_field', $this->html, $this->settings );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.