Skip to content

Commit

Permalink
Add 'template_ext' config parameter to allow templates like 'template…
Browse files Browse the repository at this point in the history
….html.php'.
  • Loading branch information
shadlaws committed May 1, 2013
1 parent 6fcde32 commit b9867e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions classes/Formo/Core/Formo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,12 @@ public function render($template = NULL)
$template = $this->config('template_dir').$template;
}

// If template_ext is defined and template doesn't already have that extension, add it
$template_ext = $this->config('template_ext');
if ($template_ext && pathinfo($template, PATHINFO_EXTENSION) != $template_ext) {
$template .= ".$template_ext";
}

$view = View::factory($template)
->set('field', $this)
->set('label', $this->label())
Expand Down
3 changes: 3 additions & 0 deletions config/formo.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
'auto_id' => TRUE,
// The directory for the formo templates (ex: 'formo' or 'formo_bootstrap')
'template_dir' => 'formo_bootstrap/',
// The extension for the formo templates
// FALSE or extension (ex: FALSE looks for 'template.php', 'html' looks for 'template.html.php')
'template_ext' => FALSE,
// Namespace fields (name="parent_alias[field_alias]")
'namespaces' => TRUE,
// Driver used for ORM integration
Expand Down

0 comments on commit b9867e3

Please sign in to comment.