has field_order => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
has excluded_fields => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
+has included_fields => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
has computed_field_order => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
has _raw_field_labels => (
sub _build_excluded_fields { []; }
+sub _build_included_fields { [] }
+
#this is a total clusterfuck and it sucks we should just eliminate it and have
# the grid members not render ArrayRef or Collection fields
sub _build_computed_field_order {
my ($self) = @_;
my %excluded = map { $_ => undef } @{ $self->excluded_fields };
+ my %included = map { $_ => undef } @{ $self->included_fields };
#treat _$field_name as private and exclude fields with no reader
- my @names = grep { $_ !~ /^_/ && !exists($excluded{$_})} map { $_->name }
+ my @names = grep { $_ !~ /^_/ && (!%included || exists( $included{$_}) )
+ && !exists($excluded{$_})} map { $_->name }
grep {
!($_->has_type_constraint &&
($_->type_constraint->is_a_type_of('ArrayRef') ||
=head2 excluded_fields
+List of field names to exclude.
+
+=head2 included_fields
+
+List of field names to include. If both C<included_fields> and
+C<excluded_fields> are specified the result is those fields which
+are in C<included_fields> and not in C<excluded_fields>.
+
+=head2 included_fields
+
+List of field names to include. If both C<included_fields> and
+C<excluded_fields> are specified the result is those fields which
+are in C<included_fields> and not in C<excluded_fields>.
+
+
=head2 field_labels
=head2 _raw_field_labels
has builder_cache => (is => 'ro', isa => 'HashRef', lazy_build => 1);
has excluded_fields => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
+has included_fields => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
has computed_field_order => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
has containers => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
sub _build_builder_cache { {} }
sub _build_excluded_fields { [] }
+sub _build_included_fields { [] }
sub _build_containers {
my $self = shift;
sub _build_computed_field_order {
my ($self) = @_;
my %excluded = map { $_ => undef } @{ $self->excluded_fields };
+ my %included = map { $_ => undef } @{ $self->included_fields };
#treat _$field_name as private and exclude fields with no reader
- my @names = grep { $_ !~ /^_/ && !exists($excluded{$_})} map { $_->name }
+ my @names = grep { $_ !~ /^_/ && (!%included || exists( $included{$_}) )
+ && !exists($excluded{$_}) } map { $_->name }
grep { defined $_->get_read_method } $self->model->parameter_attributes;
return $self->sort_by_spec($self->field_order || [], \@names);
}
=head2 excluded_fields
+List of field names to exclude.
+
+=head2 included_fields
+
+List of field names to include. If both C<included_fields> and
+C<excluded_fields> are specified the result is those fields which
+are in C<included_fields> and not in C<excluded_fields>.
+
=head2 computed_field_order
=head1 INTERNAL METHODS