Form::Sensible::Renderer::HTML - an HTML based Form renderer
use Form::Sensible::Renderer::HTML;
my $object = Form::Sensible::Renderer::HTML->new();
$object->do_stuff();
Renders a form as an HTML form. Returns a
Form::Sensible::Renderer::HTML::RenderedForm object.
- "template"
- The Template object used by this renderer. You can provide your own by
setting this attribute. If you do not set it, a new Template object is
created using the parameter below.
- "additional_include_paths"
- If you want to search outside the templates distributed with
"Form::Sensible" for field or form
templates, you can add additional paths as an arrayref here. This is
useful if you want to override the some of the templates for your fields
or forms.
This allows you to override just the elements you need to in
your own theme, with all others being sourced from the Form::Sensible
distribution ( IE provided theme and default theme ) Note that unless
configured otherwise, if a template not found in the theme you selected,
the "default" theme will be searched
as well.
- "include_paths"
- An arrayref containing the filesystem paths to search for Form::Sensible's
field templates. This defaults to including your base theme (if provided)
and then the default theme:
$self->include_paths([
$self->path_to_theme($self->base_theme),
$self->path_to_theme('default');
]);
In most cases, you should not touch
"include_paths", it is provided only
for the case where Form::Sensible is not able to determine the location
of it's templates on the filesystem. If you wish to add additional
template paths, use the
"additional_include_paths" instead.
Note also that care should be taken overriding
"include_paths" because this fallback
behavior is based only on the include path order.
- "base_theme"
- The theme to use for form rendering. Defaults to
"default", default uses
"<div>"'s for layout. There is
also 'table' which uses HTML tables for form layout.
- "tt_config"
- The config used when creating a new Template object. If you set this
manually, you will need to be sure to set the Template's
"INCLUDE_PATH" yourself or rendering
will be unable to find any field templates. You can obtain the include
path that would have been used by calling
"$self->complete_include_path()"
- "default_options"
- Default options to pass through to the RenderedForm.
- "render($form, $stash_prefill, $options)"
- Returns a RenderedForm for the form provided.
options:
- additional_tt_options
- These are passed to the Template::Toolkit constructor
"Template->new"
- "new_template()"
- Returns a new Template object created using the
"tt_config" attribute.
- "path_to_theme($theme)"
- Returns the filesystem path to the theme provided. If no
$theme is passed, it will provide the path to the
"base_theme" for the renderer
object.
- "complete_include_path()"
- Returns the complete calculated include paths to be passed to the Template
object taking into account both the
"include_paths" as well as
"additional_include_paths".
Jay Kuri - <jayk@cpan.org>
Ionzero LLC. <http://ionzero.com/>
Copyright 2009 by Jay Kuri <jayk@cpan.org>
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.