You are here

public static function PushIntent::displayNoPushReason in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/PushIntent.php \Drupal\cms_content_sync\PushIntent::displayNoPushReason()
  2. 2.0.x src/PushIntent.php \Drupal\cms_content_sync\PushIntent::displayNoPushReason()

Get a user message on why the push failed.

Parameters

Exception|string $reason: The reason from self::getNoPushReason()

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup|string

1 call to PushIntent::displayNoPushReason()
PushIntent::getNoPushReason in src/PushIntent.php
Get the reason why a push has not happened.

File

src/PushIntent.php, line 693

Class

PushIntent
Class PushIntent.

Namespace

Drupal\cms_content_sync

Code

public static function displayNoPushReason($reason) {
  if ($reason instanceof \Exception) {
    return $reason
      ->getMessage();
  }
  switch ($reason) {
    case self::NO_PUSH_REASON__HANDLER_IGNORES:
      return t('The configuration forbids the push.');
    case self::NO_PUSH_REASON__JUST_PULLED:
      return t('The entity has just been pulled and cannot be pushed immediately with the same request.');
    case self::NO_PUSH_REASON__NEVER_PUSHED:
      return t('The entity has not been pushed before, so pushing the deletion doesn\'t have any effect.');
    case self::NO_PUSH_REASON__UNCHANGED:
      return t('The entity has not changed since it\'s last push.');
    default:
      return t('The entity doesn\'t have any Pool assigned.');
  }
}