LLMS_Form_Field::get_html()

Retrieve the field’s HTML.


Return Return

(string)


Top ↑

Source Source

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

431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
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.