Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
cc108a13
Commit
cc108a13
authored
12 years ago
by
Jennifer Hodgdon
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1677830
by slashrsm: Improve docs for user and node hooks in regards to...
Issue
#1677830
by slashrsm: Improve docs for user and node hooks in regards to database transactions
parent
b06dd311
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/node/node.api.php
+24
-6
24 additions, 6 deletions
core/modules/node/node.api.php
core/modules/user/user.api.php
+16
-0
16 additions, 0 deletions
core/modules/user/user.api.php
with
40 additions
and
6 deletions
core/modules/node/node.api.php
+
24
−
6
View file @
cc108a13
...
...
@@ -509,9 +509,18 @@ function hook_node_revision_delete(Drupal\node\Node $node) {
/**
* Respond to creation of a new node.
*
* This hook is invoked from node_save() after the node is inserted into the
* node table in the database, after the type-specific hook_insert() is invoked,
* and after field_attach_insert() is called.
* This hook is invoked from node_save() after the database query that will
* insert the node into the node table is scheduled for execution, after the
* type-specific hook_insert() is invoked, and after field_attach_insert() is
* called.
*
* Note that when this hook is invoked, the changes have not yet been written to
* the database, because a database transaction is still in progress. The
* transaction is not finalized until the save operation is entirely completed
* and node_save() goes out of scope. You should not rely on data in the
* database at this time as it is not updated yet. You should also note that any
* write/update database queries executed from this hook are also not committed
* immediately. Check node_save() and db_transaction() for more info.
*
* @param Drupal\node\Node $node
* The node that is being created.
...
...
@@ -703,9 +712,18 @@ function hook_node_presave(Drupal\node\Node $node) {
/**
* Respond to updates to a node.
*
* This hook is invoked from node_save() after the node is updated in the node
* table in the database, after the type-specific hook_update() is invoked, and
* after field_attach_update() is called.
* This hook is invoked from node_save() after the database query that will
* update node in the node table is scheduled for execution, after the
* type-specific hook_update() is invoked, and after field_attach_update() is
* called.
*
* Note that when this hook is invoked, the changes have not yet been written to
* the database, because a database transaction is still in progress. The
* transaction is not finalized until the save operation is entirely completed
* and node_save() goes out of scope. You should not rely on data in the
* database at this time as it is not updated yet. You should also note that any
* write/update database queries executed from this hook are also not committed
* immediately. Check node_save() and db_transaction() for more info.
*
* @param Drupal\node\Node $node
* The node that is being updated.
...
...
This diff is collapsed.
Click to expand it.
core/modules/user/user.api.php
+
16
−
0
View file @
cc108a13
...
...
@@ -255,6 +255,14 @@ function hook_user_presave($account) {
/**
* Respond to creation of a new user account.
*
* Note that when this hook is invoked, the changes have not yet been written to
* the database, because a database transaction is still in progress. The
* transaction is not finalized until the save operation is entirely completed
* and user_save() goes out of scope. You should not rely on data in the
* database at this time as it is not updated yet. You should also note that any
* write/update database queries executed from this hook are also not committed
* immediately. Check user_save() and db_transaction() for more info.
*
* @param $account
* The user account object.
*
...
...
@@ -273,6 +281,14 @@ function hook_user_insert($account) {
/**
* Respond to updates to a user account.
*
* Note that when this hook is invoked, the changes have not yet been written to
* the database, because a database transaction is still in progress. The
* transaction is not finalized until the save operation is entirely completed
* and user_save() goes out of scope. You should not rely on data in the
* database at this time as it is not updated yet. You should also note that any
* write/update database queries executed from this hook are also not committed
* immediately. Check user_save() and db_transaction() for more info.
*
* @param $account
* The user account object.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment