/**
  * Outputs message depending on flag
  *
  * @return string
  */
 public function render()
 {
     // get messages
     $allMessages = ['danger' => array_unique(array_merge($this->flashMessenger->getErrorMessages(), $this->flashMessenger->getCurrentErrorMessages())), 'success' => array_unique(array_merge($this->flashMessenger->getSuccessMessages(), $this->flashMessenger->getCurrentSuccessMessages())), 'warning' => array_unique(array_merge($this->flashMessenger->getWarningMessages(), $this->flashMessenger->getCurrentWarningMessages())), 'info' => array_unique(array_merge($this->flashMessenger->getInfoMessages(), $this->flashMessenger->getCurrentInfoMessages())), 'default' => array_unique(array_merge($this->flashMessenger->getMessages(), $this->flashMessenger->getCurrentMessages()))];
     // clear messages
     $this->flashMessenger->clearMessagesFromContainer();
     $this->flashMessenger->clearCurrentMessagesFromContainer();
     // initialize output
     $output = '';
     // loop through messages
     foreach ($allMessages as $groupKey => $groupMessages) {
         foreach ($groupMessages as $message) {
             $addClass = $groupKey == 'default' ? '' : 'alert-' . $groupKey;
             // setup view model
             $viewModel = new ViewModel();
             $viewModel->setVariable('alertClass', $addClass);
             $viewModel->setVariable('alertMessage', $message);
             $viewModel->setTemplate('zf2rapid-library/widget/bootstrap-alert');
             // add rendered output
             $output .= $this->getView()->render($viewModel);
         }
     }
     // return output
     return $output . "\n";
 }