LLMS_Form_Field::prepare_options_from_preset()

Retrieve options list data based on the options_preset settings.


Return Return

(void)


Top ↑

Source Source

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

	protected function prepare_options_from_preset() {

		$preset_id = $this->settings['options_preset'];
		switch ( $preset_id ) {
			case 'countries':
				$options                             = get_lifterlms_countries();
				$default                             = get_lifterlms_country();
				$this->settings['wrapper_classes'][] = 'llms-l10n-country-select';
				break;

			case 'states':
				$options                             = llms_get_states();
				$this->settings['wrapper_classes'][] = 'llms-l10n-state-select';
				break;

			default:
				/**
				 * Define custom / 3rd party presets
				 *
				 * @since 5.0.0
				 *
				 * @param array $options              Array of options.
				 * @param array $settings             Prepared field settings.
				 * @param LLMS_Form_Field $fomr_field Form field object instance.
				 */
				$options = apply_filters( "llms_form_field_options_preset_{$preset_id}", array(), $this->settings, $this );
		}

		if ( isset( $options ) ) {
			$this->settings['options'] = $options;
		}

		if ( isset( $default ) && ! $this->settings['default'] ) {
			$this->settings['default'] = $default;
		}

	}


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.