LLMS_Form_Field::get_html_attributes()

Retrieve an array of HTML attributes which should be added to the main field element.


Return Return

(array)


Top ↑

Source Source

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

	protected function get_html_attributes() {

		$check = array(
			'id',
			'disabled',
			'name',
			'placeholder',
			'required',
			'value',
		);

		// Input groups and html only have an id.
		if ( $this->is_input_group() || 'html' === $this->settings['type'] ) {
			$check = array( 'id' );
		}

		$attrs = array();

		// Settings attributes.
		foreach ( $check as $attr ) {
			if ( ! empty( $this->settings[ $attr ] ) ) {
				$attrs[ $attr ] = esc_attr( wp_strip_all_tags( $this->settings[ $attr ] ) );
			}
		}

		// Any custom attributes.
		foreach ( $this->settings['attributes'] as $attr => $val ) {
			$attrs[ $attr ] = esc_attr( wp_strip_all_tags( $val ) );
		}

		if ( $this->settings['match'] ) {
			$attrs['data-match'] = $this->settings['match'];
		}

		return array_merge( $attrs, $this->get_deprecated_html_attributes() );

	}


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.