/** * The queued EE_Message for generation does not save the data used for generation as objects * because serialization of those objects could be problematic if the data is saved to the db. * So this method calls the static method on the associated data_handler for the given message_type * and that preps the data for later instantiation when generating. * * @param EE_Message_To_Generate $message_to_generate * @param bool $preview Indicate whether this is being used for a preview or not. * @return mixed Prepped data for persisting to the queue. false is returned if unable to prep data. */ protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) { /** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */ $data_handler = $message_to_generate->get_data_handler_class_name($preview); if (!$message_to_generate->valid()) { return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid. } return $data_handler::convert_data_for_persistent_storage($message_to_generate->data()); }