Um_Tokens::um_possible_tokens( array $tokens = array(), array $args = array() )


Parameters Parameters

$tokens

(array) (Optional)

Default value: array()

$args

(array) (Optional)

Default value: array()


Top ↑

Return Return

(array)


Source Source

File: src/integrations/ultimate-member/tokens/um-tokens.php

	public function um_possible_tokens( $tokens = array(), $args = array() ) {
		$form_id      = absint( $args['value'] );
		$trigger_meta = $args['meta'];
		if ( function_exists( 'UM' ) ) {
			$um_fields = UM()->query()->get_attr( 'custom_fields', $form_id );
			if ( $um_fields ) {
				$fields = array();
				foreach ( $um_fields as $field ) {
					if ( isset( $field['public'] ) && 1 === absint( $field['public'] ) ) {
						$input_id    = $field['metakey'];
						$input_title = $field['title'];
						$token_id    = "$form_id|$input_id";
						$input_type  = $field['type'];
						$fields[]    = [
							'tokenId'         => $token_id,
							'tokenName'       => $input_title,
							'tokenType'       => $input_type,
							'tokenIdentifier' => $trigger_meta,
						];
					}
				}
				$tokens = array_merge( $tokens, $fields );

			}
		}

		return $tokens;
	}