public function fetch($template, $data = null) {
    $layout = $this->getLayout($data);
    $result = $this->render($template, $data);
    if (is_string($layout)) {
      $result = $this->renderLayout($layout, $result, $data);
    }

    return $result;
  }