Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'd like to make a few minor updates to the API, specifically:
- Add an alter hook inside
crowd_client_connect()
that allows other modules to modify/decorate the connection object after it is instantiated. There is already an alter hook that allows modules to alter the class used (before the object is created), but that's really limited to a single alteration, where as giving modules the ability to decorate the result may be more flexible. Making the connection class/object a formal plugin (with ctools or something) is also an option, but as the connection object is more of a service (not a plugin) that really does not seem appropriate. - Add an alter hook inside
crowd_sync_user_data()
that allows the$edit
array to be altered just before it's passed touser_save()
.hook_crowd_presync_user_data()
is already available there (and the$edit
array was exposed as part of it in #2653110: Pass an $edit variable in hook_crowd_presync_user_data() to avoid local save ) but that hook is invoked before the main sync logic is run so modules don't really have a clean way to override any of the native sync calculations without doing something tricky, and messy, inside auser_save()
hook. - Rename
crowd_sync_user_data()
tocrowd_pull_user_data()
(while of course leavingcrowd_sync_user_data()
as an alias for backwards compatibility). This function is really related to a "pull" effort and not a bi-directional "sync", so this change seems appropriate for readability. This is especially important as there are sandbox projects now that may deal with "push" operations, which I think justifies a more precise method naming scheme. - Add
hook_hook_info()
implementation so that modules using Crowd hooks can lazy-load them if they want.
Comment | File | Size | Author |
---|---|---|---|
#4 | 2697109-4.patch | 15.75 KB | rjacobs |
|
Comments
Comment #2
rjacobs CreditAttribution: rjacobs commentedAdd relation.
Comment #3
rjacobs CreditAttribution: rjacobs at Center for Research Libraries commentedHere's a first patch.
Comment #4
rjacobs CreditAttribution: rjacobs at Center for Research Libraries commentedHere's an updated version that includes hook_hook_info().
Comment #6
rjacobs CreditAttribution: rjacobs at Center for Research Libraries commentedCommitted.