You can do this with a custom module and using the preprocess views hook to pass in the contextual filter. The filters are passed into the $args[] variable.
You also may need to enable multiple values in a contextual filter, if you have more than one relationship from Contact A to Contact B, in this case this is multiple employers. This is under Contextual Filters > Advanced > Allow multiple values.
You do not add % to the path as you would normally do with a contextual filter as we are programmatically inserting it.
Create a custom Drupal module with the following code
/**
* @implements hook_views_pre_view().
*/
function HOOK_views_pre_view(&$view, &$display_id, &$args){
if($view->name == "my_view") {
// Check that we are altering the correct view based on and $view->name
civicrm_initialize();
require_once 'api/api.php';
//get the matching civi id for the current user
//This is using Civicrm version 4.4.6
global $user;
//first get the current user's Civicrm record
$params = array(
'version' => 3,
'sequential' => 1,
'uf_id' => $user->uid,
);
/*The contact ID is in $result['values'][0]['contact_id']*/
$result = civicrm_api('UFMatch', 'get', $params);
$params = array(
'version' => 3,
'sequential' => 1,
'relationship_type_id' => 5, /*get your relationship ID from /civicrm/admin*/
'contact_id_a' => $result['values'][0]['contact_id'],
);
$result = civicrm_api('Relationship', 'get', $params);
//temp stores the string which will be passed to the $args[] array
$temp = "";
//loop through the a => b relationships, and append all the ids of contact b
foreach ($result[values] as $key => $value ) {
if ($key > 0)
$temp .= "+";
$temp .= $value['contact_id_b'];
}
// populate the $args contextual filters array with the ids.
$args[] = $temp;
}
}