use warnings; use strict; package Jifty::Param; =head1 NAME Jifty::Param - Parameters for Jifty actions =head1 DESCRIPTION Describes a parameter to a C object. Do not construct this by hand -- use L in the action package to declare parameters instead. =head2 accessors See L for the list of possible keys that each parameter can have. In addition to the list there, you may use these additional keys: =over =item constructor A boolean which, if set, indicates that the argument B be present in the C passed to create the action, rather than being expected to be set later. Defaults to false. =item valid_values An array reference. Each element should be either: =over 4 =item * A hash reference with a C field for the string to display for the value, and a C field for the value to actually send to the server. =item * A hash reference with a C field containing a L, and C and C fields containing the names of methods to call on each record in the collection to get C and C. =item * A simple string, which is treated as both C and C. =back =item available_values Just like L, but represents the list of suggested values, instead of the list of acceptable values. =item sort_order An integer of how the parameter sorts relative to other parameters. This is usually implicitly generated by its declaration order. =back =cut use base qw/Jifty::Web::Form::Field Class::Accessor::Fast/; use constant ACCESSORS => qw(constructor valid_values available_values sort_order); __PACKAGE__->mk_accessors(ACCESSORS); sub accessors { (shift->SUPER::accessors(), ACCESSORS) } =head2 new Creates a new L object. Note that unlike L, the object is never magically reblessed into a subclass. Should only be called implicitly from a L declaration. =cut # Inhibit the reblessing inherent in Jifty::Web::Form::Field->new sub new { my $class = shift; $class->Class::Accessor::Fast::new({ type => 'text', class => '', input_name => '', default_value => '', sticky_value => '', render_mode => 'update', @_, }); } 1;