You are here

public static function ExistingRightsResult::rightsExistIf in Commerce License 8.2

Creates an ExistingRightsResult from a condition.

Parameters

bool $condition: The condition to evaluate.

\Drupal\Core\StringTranslation\TranslatableMarkup $message_owner: (optional) A translated message intended to be shown to the user.

\Drupal\Core\StringTranslation\TranslatableMarkup $message_other: (optional) A translated message intended to be shown to a different user.

Return value

\Drupal\commerce_license\ExistingRights\ExistingRightsResult The result object.

3 calls to ExistingRightsResult::rightsExistIf()
ExistingRightsCheckConfig::checkUserHasExistingRights in tests/modules/commerce_license_test/src/Plugin/Commerce/LicenseType/ExistingRightsCheckConfig.php
Checks whether the user already has the rights this license grants.
Role::checkUserHasExistingRights in src/Plugin/Commerce/LicenseType/Role.php
Checks whether the user already has the rights this license grants.
StateChangeWithRightsCheck::checkUserHasExistingRights in tests/modules/commerce_license_test/src/Plugin/Commerce/LicenseType/StateChangeWithRightsCheck.php
Checks whether the user already has the rights this license grants.

File

src/ExistingRights/ExistingRightsResult.php, line 72

Class

ExistingRightsResult
Represents the result of a check for a user's existing rights.

Namespace

Drupal\commerce_license\ExistingRights

Code

public static function rightsExistIf($condition, TranslatableMarkup $message_owner = NULL, TranslatableMarkup $message_other = NULL) {
  if ($condition) {
    return static::rightsExist($message_owner, $message_other);
  }
  else {
    return static::rightsDoNotExist();
  }
}