/** * Changes necessary event properties when an event is instantiated. * Specifically, modifies the location id to the currently translated location if applicable. * @param EM_Event $EM_Event */ public static function event_get_location($EM_Location, $EM_Event) { //check if location has a translation, if so load that one if ($EM_Location->location_id) { $translated_post_id = EM_ML::get_translated_post_id($EM_Location->post_id, EM_POST_TYPE_LOCATION); if ($translated_post_id && $EM_Location->post_id != $translated_post_id) { $EM_Location = em_get_location($translated_post_id, 'post_id'); } } return $EM_Location; }
/** * Takes a page post_id and returns the translated version post_id of the language currently being viewed by the user. * Used to detect whether we're on an events listing page for example, where we would normally override the content with our formats. * @param int $post_id * @return int * @uses EM_ML::get_translated_post_id() */ public static function get_translated_page($post_id) { return EM_ML::get_translated_post_id($post_id, 'page'); }