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

386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
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.