You are here

public function Template::getTemplate in GatherContent 7.3

TBD.

Parameters

int $template_id: ID of template.

Return value

object Object of template

File

includes/Template.inc, line 113

Class

Template
Class Template.

Namespace

GatherContent

Code

public function getTemplate($template_id) {
  $template = NULL;
  try {
    $response = $this->client
      ->get('/templates/' . $template_id);
    if ($response
      ->getStatusCode() === 200) {
      $data = json_decode($response
        ->getBody());
      $template = $data->data;
    }
  } catch (\Exception $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
    watchdog('gathercontent', $e
      ->getMessage(), array(), WATCHDOG_ERROR);
  }
  return $template;
}