You are here

protected function LingotekImportForm::toStringUnsuccessfulImports in Lingotek Translation 8

This function is to list the captured doc ids in a string separated by commas so it can be displayed for the end-user in a message.

@author TJ Murphy

Parameters

array $unsuccessful_imports an array of doc ids that did not import:

Return value

string $unsuccessful_imports_string this creates an HTML string that creates an unordered list of doc ids that failed to import

1 call to LingotekImportForm::toStringUnsuccessfulImports()
LingotekImportForm::submitForm in src/Form/LingotekImportForm.php
Form submission handler.

File

src/Form/LingotekImportForm.php, line 184
Contains \Drupal\Lingotek\Form\LingotekManagementForm.

Class

LingotekImportForm
@file Contains \Drupal\Lingotek\Form\LingotekManagementForm.

Namespace

Drupal\lingotek\Form

Code

protected function toStringUnsuccessfulImports($unsuccessful_imports) {
  $unsuccessful_imports_string = '';
  $count = 0;
  foreach ($unsuccessful_imports as $doc_id) {
    if ($count != 0) {
      $unsuccessful_imports_string = $unsuccessful_imports_string . ', ' . (string) $doc_id;
    }
    else {
      $unsuccessful_imports_string = $unsuccessful_imports_string . (string) $doc_id;
    }
    $count++;
  }
  $unsuccessful_imports_string = $unsuccessful_imports_string . '.';
  return $unsuccessful_imports_string;
}