From aca53c540c69496390b172a55a46b817d2828d0f Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Wed, 10 Feb 2010 16:46:59 -0800 Subject: Bug 545541: New Hook: object_columns r=mkanat, a=mkanat (module owner) --- Bugzilla/Hook.pm | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Hook.pm') diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index faef9f07d..2f4d2a7ff 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -181,6 +181,8 @@ takes a C parameter, just like L. =head2 bug_columns +B Use L instead. + This allows you to add new fields that will show up in every L object. Note that you will also need to use the L hook in conjunction with this hook to make this work. @@ -602,6 +604,44 @@ The value being set on the object. =back +=head2 object_columns + +This hook allows you to add new "fields" to existing Bugzilla objects, +that correspond to columns in their tables. + +For example, if you added an C column to the "bugs" table, you +would have to also add an C field to the C object +in order to access that data via Bug objects. + +Don't do anything slow inside this hook--it's called several times on +every page of Bugzilla. + +Params: + +=over + +=item C + +The name of the class that this hook is being called on. You can check this +like C<< if ($class->isa('Some::Class')) >> in your code, to add new +fields only for certain classes. + +=item C + +An arrayref. Add the string names of columns to this array to add new +values to objects. + +For example, if you add an C column to a particular table +(using L), and then push the string C into +this array for the object that uses that table, then you can access the +information in that column via C<< $object->{example} >> on all objects +of that type. + +This arrayref does not contain the standard column names--you cannot modify +or remove standard object columns using this hook. + +=back + =head2 object_end_of_create_validators Called at the end of L. You can @@ -688,7 +728,7 @@ Params: The name of the class that C was called on. You can check this like C<< if ($class->isa('Some::Class')) >> in your code, to add -validators only for certain classes +validators only for certain classes. =item C -- cgit v1.2.3-24-g4f1b