You are here

function tmgmt_write_request_messages in Translation Management Tool 8

Print all messages that occurred since our request to the screen.

Parameters

\Drupal\tmgmt\JobInterface|\Drupal\tmgmt\JobItemInterface $entity: The translation job or job item for which the message should be written.

Return value

bool FALSE if there are message with severity error, TRUE otherwise.

7 calls to tmgmt_write_request_messages()
JobAbortForm::submitForm in src/Form/JobAbortForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
JobCheckoutManager::requestTranslation in src/JobCheckoutManager.php
Requests translations for a job and prints messages which have happened since then.
JobItemAbortForm::submitForm in src/Form/JobItemAbortForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
JobItemForm::ajaxReviewForm in src/Form/JobItemForm.php
Ajax callback for the job item review form.
tmgmt_file_import_form_submit in translators/tmgmt_file/tmgmt_file.module
Import form submit callback.

... See full list

File

./tmgmt.module, line 713
Main module file for the Translation Management module.

Code

function tmgmt_write_request_messages($entity) {
  $errors = FALSE;
  foreach ($entity
    ->getMessagesSince() as $message) {

    // Ignore debug messages.
    if ($message
      ->getType() == 'debug') {
      continue;
    }
    if ($message
      ->getType() == 'error') {
      $errors = TRUE;
    }
    if ($text = $message
      ->getMessage()) {
      \Drupal::messenger()
        ->addMessage($text, $message
        ->getType());
    }
  }
  return !$errors;
}