Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
2a444f9d
Commit
2a444f9d
authored
Apr 01, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 556695: New Hook: object_end_of_set
r=mkanat, a=mkanat (module owner)
parent
11e17bef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
0 deletions
+42
-0
Hook.pm
Bugzilla/Hook.pm
+28
-0
Object.pm
Bugzilla/Object.pm
+3
-0
Extension.pm
extensions/Example/Extension.pm
+11
-0
No files found.
Bugzilla/Hook.pm
View file @
2a444f9d
...
...
@@ -784,6 +784,34 @@ validated by the C<VALIDATORS> specified for the object.
=back
=head2 object_end_of_set
Called during L<Bugzilla::Object/set>, after all the code of the function
has completed (so the value has been validated and the field has been set
to the new value). You can use this to perform actions after a value is
changed for specific fields on certain types of objects.
The new value is not specifically passed to this hook because you can
get it as C<< $object->{$field} >>.
Params:
=over
=item C<object>
The object that C<set> was called on. You will probably want to
do something like C<< if ($object->isa('Some::Class')) >> in your code to
limit your changes to only certain subclasses of Bugzilla::Object.
=item C<field>
The name of the field that was updated in the object.
=back
=head2 object_end_of_set_all
This happens at the end of L<Bugzilla::Object/set_all>. This is a
...
...
Bugzilla/Object.pm
View file @
2a444f9d
...
...
@@ -306,6 +306,9 @@ sub set {
}
$self
->
{
$field
}
=
$value
;
Bugzilla::Hook::
process
(
'object_end_of_set'
,
{
object
=>
$self
,
field
=>
$field
});
}
sub
set_all
{
...
...
extensions/Example/Extension.pm
View file @
2a444f9d
...
...
@@ -386,6 +386,17 @@ sub object_end_of_create_validators {
}
sub
object_end_of_set
{
my
(
$self
,
$args
)
=
@_
;
my
(
$object
,
$field
)
=
@$args
{
qw(object field)
};
# Note that this is a made-up class, for this example.
if
(
$object
->
isa
(
'Bugzilla::ExampleObject'
))
{
warn
"The field $field has changed to "
.
$object
->
{
$field
};
}
}
sub
object_end_of_set_all
{
my
(
$self
,
$args
)
=
@_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment