Restrict_Content_Tokens::possible_tokens( array $tokens = array(), array $args = array() )
Contents
Parameters Parameters
- $tokens
-
(Optional)
Default value: array()
- $args
-
(Optional)
Default value: array()
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; }
Expand full source code Collapse full source code View on Github