diff -u b/core/modules/migrate/src/Entity/Migration.php b/core/modules/migrate/src/Entity/Migration.php --- b/core/modules/migrate/src/Entity/Migration.php +++ b/core/modules/migrate/src/Entity/Migration.php @@ -213,33 +213,23 @@ protected $entityManager; /** - * An array with the statuses as keys and labels as values. - * - * @var array + * {@inheritdoc} */ - protected static $statusList; + public function getStatusLabel() { + $status_list = [ + static::STATUS_IDLE => 'Idle', + static::STATUS_IMPORTING => 'Importing', + static::STATUS_ROLLING_BACK => 'Rolling back', + static::STATUS_STOPPING => 'Stopping', + static::STATUS_DISABLED => 'Disabled', + ]; - /** - * Retrieve a translated status string.. - * - * @param integer - * One of the MigrationInterface STATUS constants. - * - * @return string - * Translated string corresponding to a STATUS_ constant. - */ - public static function getTranslatedStatus($status) { - if (!static::$statusList) { - static::$statusList = [ - static::STATUS_IDLE => new TranslationWrapper('Idle'), - static::STATUS_IMPORTING => new TranslationWrapper('Importing'), - static::STATUS_ROLLING_BACK => new TranslationWrapper('Rolling back'), - static::STATUS_STOPPING => new TranslationWrapper('Stopping'), - static::STATUS_DISABLED => new TranslationWrapper('Disabled'), - ]; + if (isset($status_list[$this->getMigrationStatus()])) { + return $status_list[$this->getMigrationStatus()]; + } + else { + return ''; } - - return static::$statusList[$status]; } /** diff -u b/core/modules/migrate/src/Entity/MigrationInterface.php b/core/modules/migrate/src/Entity/MigrationInterface.php --- b/core/modules/migrate/src/Entity/MigrationInterface.php +++ b/core/modules/migrate/src/Entity/MigrationInterface.php @@ -100,15 +100,12 @@ const RESULT_DISABLED = 6; /** - * Retrieve a translated status string.. - * - * @param integer - * One of the MigrationInterface STATUS constants. + * Retrieve a label for the current status. * * @return string - * Translated string corresponding to a STATUS_ constant. + * User-friendly string corresponding to a STATUS_ constant. */ - public static function getTranslatedStatus($status); + public function getStatusLabel(); /** * Returns the initialized source plugin. diff -u b/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php --- b/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -239,11 +239,11 @@ */ public function import() { // Only begin the import operation if the migration is currently idle. - if (($status = $this->migration->getMigrationStatus()) !== MigrationInterface::STATUS_IDLE) { + if ($this->migration->getMigrationStatus() !== MigrationInterface::STATUS_IDLE) { $this->message->display($this->t('Migration @id is busy with another operation: @status', array( '@id' => $this->migration->id(), - '@status' => Migration::getTranslatedStatus($status), + '@status' => $this->t($this->migration->getStatusLabel()), )), 'error'); return MigrationInterface::RESULT_FAILED; }