Including Google Maps in my custom module
I didn't dig into the exact methods you are using, but if all you want to do is embed a very simple map graphic you could use something like this:

if (isset($currentclient-&gt;street_number) &amp;&amp; isset($currentclient-&gt;street)) {
      $address_var = $currentclient-&gt;street_number . " " . $currentclient-&gt;street;
      if (isset($currentclient-&gt;city)) $address_var .= "+".$currentclient-&gt;city;
      if (isset($currentclient-&gt;state)) $address_var .= "+".$currentclient-&gt;state;
      if (isset($currentclient-&gt;postal_code)) $address_var .= "+".$currentclient-&gt;postal_code;
      $address_var = str_replace(' ', '+', $address_var);
      $output = "&lt;a href='https://maps.google.com?daddr=".$address_var."'&gt;&lt;img style='float: right; ' src='https://maps.googleapis.com/maps/api/staticmap?center=".$address_var."&amp;zoom=15&amp;size=300x150
&amp;markers=color:blue%7Clabel:*%7C".$address_var."' /&gt;&lt;/a&gt;";
    }


Or, I suppose a render array would simply change the $output= line above to be something like this:

$output =  array(
    'map' =&gt; array(
      '#type' =&gt; 'markup',
      '#markup' =&gt; '&lt;a href="https://maps.google.com?daddr='.$address_var.'"&gt;&lt;img  src="https://maps.googleapis.com/maps/api/staticmap?center='.$address_var.'&amp;zoom=15&amp;size=300x150
    &amp;markers=color:blue%7Clabel:*%7C'.$address_var.'" /&gt;&lt;/a&gt;',
    ),
);