[Jifty-commit] r7168 - jifty/trunk/lib/Jifty/Web/Form

Jifty commits jifty-commit at lists.jifty.org
Tue Jun 2 17:09:28 EDT 2009


Author: sartak
Date: Tue Jun  2 17:09:28 2009
New Revision: 7168

Modified:
   jifty/trunk/lib/Jifty/Web/Form/Field.pm

Log:
Add available_values management for fields

Modified: jifty/trunk/lib/Jifty/Web/Form/Field.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field.pm	Tue Jun  2 17:09:28 2009
@@ -127,7 +127,7 @@
 );
 
 my @semiexposed_fields = qw(
-    label input_name
+    label input_name available_values
 );
 
 sub accessors {
@@ -780,6 +780,18 @@
 
 sub available_values {
     my $self = shift;
+
+    # Setter
+    if (@_) {
+        return $self->_available_values(@_);
+    }
+
+    # If the available_values are available in the field..
+    if (my @available = $self->_available_values) {
+        return @available;
+    }
+
+    # Otherwise consult the action
     return @{ $self->action->available_values($self->name) };
 }
 


More information about the Jifty-commit mailing list