Skip to content

Commit

Permalink
expose app_key as a variable to compliled templates. #131
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Apr 2, 2015
1 parent deec2ac commit 7074bbd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Model/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ public function compile($options=array())

} elseif ($this->type == static::TYPE_TEMPLATE) {
$app->view->setTemplateString($this->code);

// Expose app_key to compiled templates.
// Mainly used to generate server-side routes when
// `Hook\View\Helper::link_to` isn't capable to handle it
//
// TODO: remove this after implementing issue #131
// (https://github.com/doubleleft/hook/issues/131)
$options['app_key'] = \Hook\Application\Context::getKey();

return $app->view->render($this->name, $options);
}

Expand Down

0 comments on commit 7074bbd

Please sign in to comment.