Rose::HTMLx::Form::Related::Metadata - RHTMLO Form class metadata


Rose-HTMLx-Form-Related documentation  | view source Contained in the Rose-HTMLx-Form-Related distribution.

Index


NAME

Top

Rose::HTMLx::Form::Related::Metadata - RHTMLO Form class metadata

DESCRIPTION

Top

Rose::HTMLx::Form::Related::Metadata interrogates and caches interrelationships between Form and ORM classes.

You typically access an instance of this class via the metadata() method in your Form class.

METHODS

Top

init

Overrides base init() method to build metadata.

form( [form] )

Get/set the Rose::HTMLx::Related::Form object.

relationship_data( [hash_ref] )

Get/set the hash ref of RelInfo objects, keyed by the RelInfo->name value.

show_relationships

Boolean indicating whether the View should provide links to related tables based on RDBO relationship method names that do not have corresponding field names.

init_controller_prefix

The default is undef.

init_labels

Should return a hashref of method (field) names to labels. Useful for giving labels to non-fields like relationship names.

init_sort_prefix

Should return a hashref of method (field) names to any strings that should be prefixed to the name for sorting. This is to support (for example) sorts on multi-table joins.

Default is empty hashref.

init_object_class

Should return the name of the ORM object class the Form class represents. Default is the Form class name less the ::Form part.

init_field_uris

Should return a hashref of field name to a URI value.

init_default_sort_by

Should return the name of the field to sort by in (for example) search results.

Default is null (empty string).

init_default_selected

Should return the name of the relationship to show as initially active in an interface.

Default is null (emptry string).

init_takes_object_as_argument

Set hash ref of ORM method names in foreign_class that take the related ORM object as a single argument.

field_uri( field_name )

Returns the value from field_uris() for key field_name if such a key exists. Otherwise, returns undef.

init_field_methods

Returns array of method names to use for rendering form. Default is form->field_names().

You may want to override this value, especially for large forms, in order to show only a subset of the most meaningful field values.

init_relationships

You may define the Form relationships as an array ref using this method in your subclass, or via the "relationships" key/value pair in new().

If you define this value explicitly, the value must be an array ref of either Rose::HTMLx::Form::Related::RelInfo objects, or hash refs (which will be blessed into Rose::HTMLx::Form::Related::RelInfo objects).

If not defined, discover_relationships() is automatically called internally in new(). The default return value is undef, triggering discover_relationships. You can turn off relationships altogether if you set it to an empty array ref, although that begs the question of why you are using Rose::HTMLx::Form::Related in the first place.

init_relinfo_class

Returns the default value 'Rose::HTMLx::Form::Related::RelInfo'.

discover_relationships

This method must be overriden by model-specific subclasses. The method should interrogate object_class() and set the array ref of relinfo_class() objects via the relationships() mutator method.

has_relationship_info( relationship )

Returns true if relationship information is known.

relationship_info( relationship )

Returns the same RelInfo object as related_field(), only using a relationship object or name instead of a field name.

foreign_field_value( field_name, object )

Returns the value from the foreign object related to object for the foreign column related to field_name.

Returns undef if (a) there is no foreign field related to field_name or (b) if there is no foreign object.

Example:

 my $username = $form->foreign_field_value( 'email_address', $person );
 # $username comes from a $user record related to $person

AUTHOR

Top

Peter Karman, <karman at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-rose-htmlx-form-related at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rose-HTMLx-Form-Related. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Rose::HTMLx::Form::Related

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Rose-HTMLx-Form-Related

* CPAN Ratings

http://cpanratings.perl.org/d/Rose-HTMLx-Form-Related

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Rose-HTMLx-Form-Related

* Search CPAN

http://search.cpan.org/dist/Rose-HTMLx-Form-Related

ACKNOWLEDGEMENTS

Top

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

COPYRIGHT & LICENSE

Top


Rose-HTMLx-Form-Related documentation  | view source Contained in the Rose-HTMLx-Form-Related distribution.