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 to user_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 a user_save() hook.
  • Rename crowd_sync_user_data() to crowd_pull_user_data() (while of course leaving crowd_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.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rjacobs created an issue. See original summary.

rjacobs’s picture

rjacobs’s picture

Status: Active » Needs review
FileSize
15.22 KB

Here's a first patch.

rjacobs’s picture

Issue summary: View changes
FileSize
15.75 KB

Here's an updated version that includes hook_hook_info().

  • rjacobs committed 0fe0844 on 7.x-2.x
    Issue #2697109 by rjacobs: Minor API enhancements - Add new alter hooks...
rjacobs’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.