LLMS_Controller_Achievements::get_text( int $text_type, array $variables = array() )

Returns a translated text of the given type.


Parameters Parameters

$text_type

(int) (Required) One of the LLMS_Abstract_Controller_User*Engagements::TEXT* constants.

$variables

(array) (Optional) variables that are used in sprintf().

Default value: array()


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/controllers/class.llms.controller.achievements.php

	protected function get_text( $text_type, $variables = array() ) {

		switch ( $text_type ) {
			case self::TEXT_SYNC_AWARDED_ENGAGEMENT_INSUFFICIENT_PERMISSIONS:
				return sprintf(
					/* translators: %1$d: awarded achievement ID */
					__( 'Sorry, you are not allowed to edit the awarded achievement #%1$d.', 'lifterlms' ),
					( $variables['engagement_id'] ?? 0 )
				);
			case self::TEXT_SYNC_AWARDED_ENGAGEMENT_INVALID_TEMPLATE:
				return sprintf(
					/* translators: %1$d: awarded achievement ID */
					__( 'Sorry, the awarded achievement #%1$d does not have a valid achievement template.', 'lifterlms' ),
					( $variables['engagement_id'] ?? 0 )
				);
			case self::TEXT_SYNC_AWARDED_ENGAGEMENTS_INSUFFICIENT_PERMISSIONS:
				return __( 'Sorry, you are not allowed to edit awarded achievements.', 'lifterlms' );
			case self::TEXT_SYNC_AWARDED_ENGAGEMENTS_INVALID_NONCE:
				return __( 'Sorry, you are not allowed to sync awarded achievements.', 'lifterlms' );
			case self::TEXT_SYNC_MISSING_AWARDED_ENGAGEMENT_ID:
				return __( 'Sorry, you need to provide a valid awarded achievement ID.', 'lifterlms' );
			case self::TEXT_SYNC_MISSING_ENGAGEMENT_TEMPLATE_ID:
				return __( 'Sorry, you need to provide a valid achievement template ID.', 'lifterlms' );
			default:
				return parent::get_text( $text_type );
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.