USE
One of the most commonly used controller keywords, controls_table
must be the name of a table
block in the same bigtop file. This adds a use statement for the table's model and provides the link between controller methods and the underlying table. This affects things like column labels on main listings, HTML form input element labels, etc.
EXAMPLE
Build the example with:
bigtop -c example.bigtop all
Look in lib/Kids/Child.pm
to see
use Kids::Model::child qw(
$CHILD
);
#...
sub get_model_name {
return $CHILD;
}
The model use statement is repeated in lib/Kids/GEN/Child.pm
from which Kids::Child
inherits. To see side affects of controls_table
, look in the generated do_main
:
my $retval = {
headings => [
'Name',
'Birth Day',
],
};
The Name
and Birth Day
labels were taken from the label
statements of fields blocks in the child
table, because they were listed in the cols
statement.
Other similar magic happens because of controls_table
.