function expand_connected_type(&$q)
 {
     if (!isset($q['connected_type'])) {
         return;
     }
     $ctype = p2p_type(_p2p_pluck($q, 'connected_type'));
     if (!$ctype) {
         return false;
     }
     if (isset($q['connected_direction'])) {
         $directed = $ctype->set_direction(_p2p_pluck($q, 'connected_direction'));
     } else {
         if ('any' == $q['connected_items']) {
             $post_type = isset($q['post_type']) ? $q['post_type'] : 'post';
         } else {
             $post_type = $q['connected_items'];
         }
         $directed = P2P_Query::find_direction($ctype, $post_type, 'post');
     }
     if (!$directed) {
         trigger_error("Can't determine direction", E_USER_WARNING);
         return false;
     }
     $q = $directed->get_connected_args($q);
     return true;
 }