You are here

private function ImportForm::addResultMessage in Default Content Deploy 8

Add a message with importing results.

1 call to ImportForm::addResultMessage()
ImportForm::submitForm in src/Form/ImportForm.php
Form submission handler.

File

src/Form/ImportForm.php, line 175

Class

ImportForm
Config Form for run DCD deploy in Admin UI.

Namespace

Drupal\default_content_deploy\Form

Code

private function addResultMessage() {
  $result = $this->importer
    ->getResult();
  $array_column = array_column($result, 'status');
  $count = array_count_values($array_column);
  $this->messenger
    ->addMessage($this
    ->t('Created: @count', [
    '@count' => isset($count['create']) ? $count['create'] : 0,
  ]));
  $this->messenger
    ->addMessage($this
    ->t('Updated: @count', [
    '@count' => isset($count['update']) ? $count['update'] : 0,
  ]));
  $this->messenger
    ->addMessage($this
    ->t('Skipped: @count', [
    '@count' => isset($count['skip']) ? $count['skip'] : 0,
  ]));
  return $this;
}