FCRM_USER_STATUS_UPDATED::get_tokens()

Returns the tokens.


Return Return

(array) The tokens.


Source Source

File: src/integrations/fluent-crm/triggers/fcrm-user-status-updated.php

	public function get_tokens() {

		$token_id = 'FLUENTCRM_STATUS_FIELD_';

		if ( ! class_exists( '\FluentCrm\App\Models\Subscriber' ) ) {
			$tokens = array();
		}

		// Regular contact profile fields.
		$mappable_fields = (array) \FluentCrm\App\Models\Subscriber::mappables();

		$tokens['FLUENTCRM_STATUS_FIELD_status'] = esc_attr__( 'Subscription Status', 'uncanny-automator' );

		foreach ( $mappable_fields as $field_id => $field_label ) {
			$tokens[ $token_id . $field_id ] = $field_label;
		}

		// Custom contact profile fields.
		$custom_fields = new \FluentCrm\App\Models\CustomContactField();

		$custom_fields = $custom_fields->getGlobalFields()['fields'];

		if ( ! empty( $custom_fields ) ) {
			foreach ( $custom_fields as $custom_field ) {
				$tokens[ $token_id . $custom_field['slug'] ] = $custom_field['label'];
			}
		}

		return $tokens;

	}