Warning: This method has been deprecated. Use Automator()->helpers->recipe->field->select() instead

Automator_Helpers_Recipe_Field::select_field( $option_code = 'SELECT',  $label = null,  $options = array(),  $default = null,  $is_ajax = false,  $fill_values_in = '',  $relevant_tokens = array(),  $args = array() )


Parameters Parameters

$option_code

(Optional)

Default value: 'SELECT'

$label

(Optional)

Default value: null

$options

(Optional)

Default value: array()

$default

(Optional)

Default value: null

$is_ajax

(Optional)

Default value: false

$fill_values_in

(Optional)

Default value: ''


Top ↑

Return Return

(mixed)


Source Source

File: src/core/lib/helpers/class-automator-recipe-helpers-field.php

	public function select_field( $option_code = 'SELECT', $label = null, $options = array(), $default = null, $is_ajax = false, $fill_values_in = '', $relevant_tokens = array(), $args = array() ) {
		if ( defined( 'AUTOMATOR_DEBUG_MODE' ) && true === AUTOMATOR_DEBUG_MODE ) {
			_doing_it_wrong( 'Automator()->helpers->recipe->field->select_field()', 'Use Automator()->helpers->recipe->field->select() instead.', '3.0' );
		}

		// TODO this function should be the main way to create select fields
		// TODO chained values should be introduced using the format in function "list_gravity_forms"
		// TODO the following function should use this function to create selections
		// -- less_or_greater_than
		// -- all_posts
		// -- all_pages
		// -- all_ld_courses
		// -- all_ld_lessons
		// -- all_ld_topics
		// -- all_ld_groups
		// -- all_ld_quiz
		// -- all_buddypress_groups
		// -- all_wc_products
		// -- list_contact_form7_forms
		// -- list_bbpress_forums
		// -- wc_order_statuses
		// -- wp_user_roles
		// -- list_gravity_forms
		// -- all_ec_events
		// -- all_lp_courses
		// -- all_lp_lessons
		// -- all_lf_courses
		// -- all_lf_lessons

		if ( ! $label ) {
			$label = esc_attr__( 'Option', 'uncanny-automator' );
		}

		$custom_value_description = key_exists( 'custom_value_description', $args ) ? $args['custom_value_description'] : null;
		$supports_custom_value    = key_exists( 'supports_custom_value', $args ) ? $args['supports_custom_value'] : null;
		$supports_tokens          = key_exists( 'supports_tokens', $args ) ? $args['supports_tokens'] : null;
		$support_token            = apply_filters( 'uap_option_' . $option_code . '_select_field', array( false ), '3.0', 'automator_option_' . $option_code . '_select_field' );
		$support_token            = apply_filters( 'automator_option_' . $option_code . '_select_field', $support_token );
		$option                   = [
			'option_code'              => $option_code,
			'label'                    => $label,
			'input_type'               => 'select',
			'supports_tokens'          => $support_token,
			'required'                 => true,
			'default_value'            => $default,
			'options'                  => $options,
			'custom_value_description' => $custom_value_description,
			'supports_custom_value'    => $supports_custom_value,
			'supports_tokens'          => $supports_tokens,
			//'is_ajax'         => $is_ajax,
			//'chained_to'      => $fill_values_in,
		];

		if ( ! empty( $relevant_tokens ) ) {
			$option['relevant_tokens'] = $relevant_tokens;
		}

		//$option = $this->select( $option );
		$option = apply_filters_deprecated( 'uap_option_select_field', array( $option ), '3.0', 'automator_option_select_field' );

		return apply_filters( 'automator_option_select_field', $option );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0 Introduced.