Tokens::generate_token_name( string $token_id, string $prefix = '' )


Parameters Parameters

$token_id

(string) (Required)

$prefix

(string) (Optional)

Default value: ''


Top ↑

Return Return

(string)


Source Source

File: src/core/lib/recipe-parts/trait-tokens.php

	public static function generate_token_name( string $token_id, string $prefix = '' ) {
		if ( empty( $prefix ) ) {
			return ucfirst( str_replace( array( '_', '-' ), ' ', $token_id ) );
		}

		return sprintf(
			'%s: %s',
			$prefix,
			ucfirst(
				str_replace(
					array(
						'_',
						'-',
					),
					' ',
					$token_id
				)
			)
		);
	}