/** * Given the token (reg_url_link) and (optionally) the $data_id, this returns the appropriate data object(s) for the given message_type. * * @since 4.5.0 * @throws EE_Error * * @param string $generating_messenger The messenger that is used for generating templates for this message type. * @param string $message_type Used to figure out what data handler is used (which in turn enables us to know what data type is required) * @param EE_Registration $registration * @param int $data_id Some data handlers require a specific object. The id is used to provide that specific object. * @param string $context what context is being requested. * * @return mixed (EE_Base_Class||EE_Base_Class[]) */ protected function _get_messages_data_from_url($generating_messenger, $message_type, EE_Registration $registration, $data_id, $context) { //get message type object then get the correct data setup for that message type. $message_type = self::$_EEMSG->get_active_message_type($generating_messenger, $message_type); //if no message type then it likely isn't active for this messenger. if (!$message_type instanceof EE_message_type) { throw new EE_Error(sprintf(__('Unable to get data for the %s message type, likely because it is not active for the %s messenger.', 'event_espresso'), $message_type->name, $generating_messenger)); } //get data according to data handler requirements return $message_type->get_data_for_context($context, $registration, $data_id); }