From 3ba6d43ec967889cad461a7f22778e2ec1534192 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 4 Nov 2011 11:54:31 -0700 Subject: [PATCH] Allow noFormPost to be dynamically generated with a sub. Not all property settings allow this! --- lib/WebGUI/Asset.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 1f3e46732..51f58aa4d 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1276,9 +1276,13 @@ sub getFieldData { my $attr = $self->meta->find_attribute_by_name( $property ); my $fieldType = $attr->fieldType; my $fieldOverrides = $overrides->{ $property } || {}; + my $noFormPost = $attr->noFormPost; + if (ref $noFormPost eq 'CODE') { + $noFormPost = $self->$noFormPost; + } my $fieldHash = { fieldType => $fieldType, - noFormPost => $attr->noFormPost, + noFormPost => $noFormPost, tab => "properties", %{ $self->getFormProperties( $property ) }, %{ $overrides }, @@ -1878,6 +1882,7 @@ exception. sub loadModule { my ($class, $className) = @_; if ($className !~ /^WebGUI::Asset(?:::\w+)*$/ ) { + warn $className; WebGUI::Error::InvalidParam->throw(param => $className, error => "Not a WebGUI::Asset class",); } (my $module = $className . '.pm') =~ s{::}{/}g;