/**
  * Retrieve and set the message preview for display.
  *
  * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
  * @return string
  */
 public function _preview_message($send = false)
 {
     //first make sure we've got the necessary parameters
     if (!isset($this->_req_data['message_type'], $this->_req_data['messenger'], $this->_req_data['messenger'], $this->_req_data['GRP_ID'])) {
         EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
     }
     EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
     //get the preview!
     $preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
     if ($send) {
         return $preview;
     }
     //let's add a button to go back to the edit view
     $query_args = array('id' => $this->_req_data['GRP_ID'], 'context' => $this->_req_data['context'], 'action' => 'edit_message_template');
     $go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
     $preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
     $message_types = $this->get_installed_message_types();
     $active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
     $active_messenger_label = $active_messenger instanceof EE_messenger ? ucwords($active_messenger->label['singular']) : esc_html__('Unknown Messenger', 'event_espresso');
     //let's provide a helpful title for context
     $preview_title = sprintf(__('Viewing Preview for %s %s Message Template', 'event_espresso'), $active_messenger_label, ucwords($message_types[$this->_req_data['message_type']]->label['singular']));
     //setup display of preview.
     $this->_admin_page_title = $preview_title;
     $this->_template_args['admin_page_content'] = $preview_button . '<br />' . stripslashes($preview);
     $this->_template_args['data']['force_json'] = true;
     return '';
 }
 /**
  * @deprecated 4.9.0
  * @param  string $type      This should correspond with a valid message type
  * @param  string $context   This should correspond with a valid context for the message type
  * @param  string $messenger This should correspond with a valid messenger.
  * @param bool    $send      true we will do a test send using the messenger delivery, false we just do a regular preview
  * @return string          The body of the message.
  */
 public function preview_message($type, $context, $messenger, $send = false)
 {
     // EE_messages has been deprecated
     $this->_class_is_deprecated(__FUNCTION__);
     return EED_Messages::preview_message($type, $context, $messenger, $send);
 }