backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 38 forks source link

User Role CRUD hook docs need to be updated (remove mention of database) #6522

Closed jenlampton closed 3 weeks ago

jenlampton commented 3 weeks ago

In Drupal 7 user roles were stored in the databse. In Backdrop, they are now stored in config. The descriptions of these hooks, however, still indicated that user role objects are stored in the database (when they are not).

We still have the following hooks, and their description text should be updaed.

hook_user_role_insert Current text:

Modules implementing this hook can act on the user role object when saved to the database. It's recommended that you implement this hook if your module adds additional data to user roles object. The module should save its custom additions to the database.

hook_user_role_insert Suggested text:

Modules implementing this hook can act on the user role object when saved to configuration. It's recommended that you implement this hook if your module adds additional data to the user roles object. The module can save its custom additions elsewhere, if needed.

hook_user_role_update current text:

Modules implementing this hook can act on the user role object when updated. It's recommended that you implement this hook if your module adds additional data to user roles object. The module should save its custom additions to the database.

hook_user_role_update suggested text:

Modules implementing this hook can act on the user role object when updated. It's recommended that you implement this hook if your module adds additional data to user roles object. The module can save its custom additions elsewhere, if needed.

hook_user_role_presave current text:

Modules implementing this hook can act on the user role object before it has been saved to the database.

hook_user_role_presave suggested text:

Modules implementing this hook can act on the user role object before it has been saved to configuration. 

hook_user_role_delete current text:

This hook allows you act when a user role has been deleted. If your module stores references to roles, it's recommended that you implement this hook and delete existing instances of the deleted role in your module database tables.

hook_user_role_delete suggested text:

Modules implementing this hook can act when a user role has been deleted. If your module stores references to roles, it's recommended that you implement this hook to delete existing instances of the deleted role.
kiamlaluno commented 3 weeks ago

This has been reported on #5942, which has a PR for hook_user_role_*() and hook_node_type_*().

klonos commented 3 weeks ago

@jenlampton I'm closing this as a duplicate of #5942. I've copied your more complete list of functions and current/suggested texts over to the issue summary of that other issue. Care to chime in there? (@kiamlaluno has suggested an alternative approach)