Gantry::Utils::FormMunger

Gantry::Utils::FormMunger munges form hashes like the ones bigtop makes.
Download

Gantry::Utils::FormMunger Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Phil Crow
  • Publisher web site:
  • http://search.cpan.org/~tkeefer/Gantry-3.51/lib/Gantry/Utils/FormMunger.pm

Gantry::Utils::FormMunger Tags


Gantry::Utils::FormMunger Description

Gantry::Utils::FormMunger munges form hashes like the ones bigtop makes. Gantry::Utils::FormMunger munges form hashes like the ones bigtop makes.SYNOPSIS use Gantry::Utils::FormMunger; my $form = ...; # make a form hash my $munger = Gantry::Utils::FormMunger->new( $form ); # change properties of existing fields: $munger->clear_props( 'field_name', qw( name keys to delete) ); $munger->clear_all_props( 'field_name' ); # removes all keys except name $munger->set_props( 'field_name', { prop => 'value', ... }, $replace_props ); # modifies only the keys you pass $munger->set_props_for_fields( , { prop => 'value', ... }, ); # like set_props but for all listed fields $munger->set_props_except_for( , { prop => 'value', ... }, ); # like set_props_for, but negated listed fields are skipped $munger->set_props_all( { prop => 'value', ... } ); # get the field so you can work it yourself: my $field = $munger->get_field( 'name' ); # modify the field list: my $deceased = $munger->drop_field( 'name' ); # removes it from the form $munger->append_field( { name => 'name', ... } ); # add at end $munger->unshift_field( { name => 'name', ... } ); # add at beginning $munger->add_field_after( 'target', { name => 'name', ... } ); $munger->add_field_before( 'target', { name => 'name', ... } );This module is designed to simplify work with Gantry form.tt form hash data structures. If makes modifications to the fields array in that hash. Usually, bigtop generates that hash. If you are in a standard CRUD situation, the generated form is all you need. But, if you need to share the form in different contexts, it may be necessary to modify it to suit those contexts. That is what this module does.If you want, you could even use this module to build your entire form hash, but that might be painful. Instead, you usually pass a form hash to its constructor. Usually, you get that hash from a GEN module's form method which was generated by bigtop.Once you have the object, you can call any of the methods below to modify its fields array. Most of the methods return nothing useful. The exceptions are noted below.All methods are instance methods unless marked. Requirements: · Perl


Gantry::Utils::FormMunger Related Software