allow edit templates without attached forms

This lets authors not use FormBuilder unless they really want to... for now.
This commit is contained in:
Doug Bell 2011-08-01 16:33:17 -05:00
parent 1992f33de9
commit aabb4648d6

View file

@ -2744,8 +2744,10 @@ sub www_add {
my $template = eval { $newAsset->getEditTemplate };
return $@ if $@;
$template->getForm("form")->action( $self->getUrl );
$template->getForm("form")->addField( "Hidden", name => "func", value => "addSave" );
if ( $template->getForm("form") ) {
$template->getForm("form")->action( $self->getUrl );
$template->getForm("form")->addField( "Hidden", name => "func", value => "addSave" );
}
return $template;
}
@ -2893,7 +2895,9 @@ sub www_edit {
return $self->session->privilege->locked() unless $self->canEditIfLocked;
my $template = $self->getEditTemplate;
$template->getForm('form')->addField( "Hidden", name => "func", value => "editSave" );
if ( my $form = $template->getForm('form') ) {
$form->addField( "Hidden", name => "func", value => "editSave" );
}
return $template;
}