Give_Helpers::list_all_give_forms( $label = null,  $option_code = 'MAKEDONATION',  $args = array() )


Source Source

File: src/integrations/give/helpers/give-helpers.php

	public function list_all_give_forms( $label = null, $option_code = 'MAKEDONATION', $args = array() ) {



		if ( ! $label ) {
			$label = __( 'Form', 'uncanny-automator' );
		}

		$token        = key_exists( 'token', $args ) ? $args['token'] : false;
		$is_ajax      = key_exists( 'is_ajax', $args ) ? $args['is_ajax'] : false;
		$target_field = key_exists( 'target_field', $args ) ? $args['target_field'] : '';
		$end_point    = key_exists( 'endpoint', $args ) ? $args['endpoint'] : '';
		$options      = array();

		$query_args = [
			'post_type'      => 'give_forms',
			'posts_per_page' => 9999,
			'post_status'    => 'publish',
		];
		$options    = Automator()->helpers->recipe->wp_query( $query_args, true, __( 'Any form', 'uncanny-automator' ) );
		$type       = 'select';

		$option = [
			'option_code'     => $option_code,
			'label'           => $label,
			'input_type'      => $type,
			'required'        => true,
			'supports_tokens' => $token,
			'is_ajax'         => $is_ajax,
			'fill_values_in'  => $target_field,
			'endpoint'        => $end_point,
			'options'         => $options,
			'relevant_tokens' => [
				'ACTUALDONATEDAMOUNT' => esc_attr__( 'Donated amount', 'uncanny-automator' ),
				$option_code          => esc_attr__( 'Form', 'uncanny-automator' ),
			],
		];

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