Skip to content

Instantly share code, notes, and snippets.

@bentglasstube
Created July 28, 2014 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bentglasstube/6f4901d3bce25dcc46d8 to your computer and use it in GitHub Desktop.
Save bentglasstube/6f4901d3bce25dcc46d8 to your computer and use it in GitHub Desktop.
cng : create base class for your forms, and set
widget_name_space there.
cng : Don't forget field_name_space while you're at it. You may
well want to customize (or create new) field types as well
bentglasstube : ah yeah that makes sense, I've been at it too long today
and not thinking of the obvious solution
cng : :-D
cng : I went through same process late last year ;-)
bentglasstube : one problem I will have with that is that some of my
forms use HTML::FormHandler and some use
HTML::FormHandler::Model::DBIC
cng : Two base classes, second inherits first; "your" classes
inherit one of them
cng : I've got ::Form::Base and Form::DBIC::Base
cng : You can guess where my form classes go ;-)
bentglasstube : and ::Form::DBIC::Base inherets from ::Form::Base or just
from ::HTML::FormHandler::Model::DBIC directly?
cng : inherits Form::Base
bentglasstube : I see. How does it get the goods from Model::DBIC then,
as a role or something?
cng : extends 'CNG::HTML::FormHandler::Form::Base'; with (
'HTML::FormHandler::TraitFor::Model::DBIC' );
bentglasstube : ah, okay, that was the missing link
bentglasstube : thanks so much for your help
cng : Technically, I do this: with (
'HTML::FormHandler::TraitFor::Model::DBIC' => {
-excludes => 'schema' }); # we provided our own in
:::Form::Base
cng : I needed `schema` in some custom fields used in 'gerneic'
forms
bentglasstube : right, I don't think I'll be to that level just yet
cng : No, which is why first example had that removed. But also
included it since I can imagine it being common problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment