LLMS_Form_Field::prepare()

Prepares the field for rendering by configuring all of it’s settings.


Return Return

(void)


Top ↑

Source Source

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

621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
protected function prepare() {
 
    if ( empty( $this->settings['id'] ) ) {
        $this->settings['id'] = uniqid( 'llms-field-' );
    }
 
    $this->prepare_wrapper_classes();
 
    $this->settings['classes'] = $this->classes_ensure_array( $this->settings['classes'] );
 
    // Allow setting `disabled` to `true` to disable the field.
    if ( true === $this->settings['disabled'] ) {
        $this->settings['disabled'] = 'disabled';
    }
 
    // Allow setting `required` to `true` to make the field required the field.
    if ( true === $this->settings['required'] ) {
        $this->settings['required'] = 'required';
    }
 
    // When name is `false` we don't want to output a name on the field.
    if ( false !== $this->settings['name'] ) {
        // Use the field id as the name if name isn't specified.
        $this->settings['name'] = empty( $this->settings['name'] ) ? $this->settings['id'] : $this->settings['name'];
    }
 
    // When `data_store_key` is false we won't automatically store or populate the field.
    if ( false !== $this->settings['data_store_key'] && empty( $this->settings['data_store_key'] ) ) {
        $this->prepare_storage();
    }
 
    // Add preset options.
    if ( $this->settings['options_preset'] ) {
        $this->prepare_options_from_preset();
    } elseif ( ! empty( $this->settings['options'] ) ) {
        $this->settings['options'] = $this->prepare_options( $this->settings['options'] );
    }
 
    $this->prepare_value();
 
    if ( 'llms-password-strength-meter' === $this->settings['id'] ) {
        $this->prepare_password_strength_meter();
    } elseif ( 'llms_voucher' === $this->settings['id'] ) {
        $this->prepare_voucher();
    }
 
}


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.