Restrict_Content_Tokens::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/restrict-content/tokens/restrict-content-tokens.php

	public function possible_tokens( $tokens = array(), $args = array() ) {

		if ( ! isset( $args['value'] ) || ! isset( $args['meta'] ) ) {
			return $tokens;
		}

		if ( empty( $args['value'] ) || empty( $args['meta'] ) ) {
			return $tokens;
		}

		$id = $args['value'];

		$new_tokens = array();
		if ( ! empty( $id ) && absint( $id ) ) {
			$new_tokens[] = [
				'tokenId'         => 'RCMEMBERSHIPLEVEL_INITIAL',
				'tokenName'       => _x( 'Membership initial payment', 'Restrict Content', 'uncanny-automator' ),
				'tokenType'       => 'text',
				'tokenIdentifier' => 'RCPURCHASESMEMBERSHIP',
			];
			$new_tokens[] = [
				'tokenId'         => 'RCMEMBERSHIPLEVEL_RECURRING',
				'tokenName'       => _x( 'Membership recurring payment', 'Restrict Content', 'uncanny-automator' ),
				'tokenType'       => 'text',
				'tokenIdentifier' => 'RCPURCHASESMEMBERSHIP',
			];

			$tokens = array_merge( $tokens, $new_tokens );
		}

		return $tokens;
	}