Many prospective Drupal contributors are turned off helping our project because the concept and naming of hooks in Drupal both frightens and confuses them. FRIGHTENS and CONFUSES. Sadly, this is a pretty common occurrence.

In order to address this problem, the SAC (Sensible API Calls) Initiative has been formed. Our first task has been to clarify and simplify alter hooks throughout Drupal.

Simply put, all hook_THING_alter() implementations have been renamed to hook_mess_with_THING() so as to more accurately reflect what happens when these functions are used. Accordingly, drupal_alter() has also been reimplemented as mess_with_drupal().

Updating your contrib modules to work with these updated hooks is trivial and new API documentation is inlcuded in the path. Thus, the SAC team are confident these changes will be available for production as of Drupal 7.13.

CommentFileSizeAuthor
alter-api-cleanup.patch306 KBcafuego

Comments

aspilicious’s picture

I'm also confused by variable_get() because it also provides a default in case the variable is unknown. Wouldn't variable_get_with_possible_the_default_value() be better?

sirtet’s picture

oh no! I think thats a totally pointless idea, really bad! At least, this should be delayed until the sheduled release of April 2013, so everyone gets a second Chance to realize what this Initiative really aims at!

xjm’s picture

Status: Active » Needs review

This looks like a valuable API cleanup to me.

NR for the bot.

Status: Needs review » Needs work

The last submitted patch, alter-api-cleanup.patch, failed testing.

xjm’s picture

Surprisingly few fails, given the scope of the API change. The mess_with_drupal() tests are probably the best place to start debugging.

xjm’s picture

Oops, realized as I started debugging that the patch is against D7. @cafuego, would it be possible to provide a D8 patch first as per our backport policy? That way we can ensure that D8 does not have a regression from 7.13.

barrett’s picture

What this patch fails to address is an explicit prioritization of API calls. For instance, module A absolutely must override the messing with done by modules B and C. Sure, we could rely on weight as we've done thus far, but then you don't know from the code who's going to have final override authority. I propose making this explicit in the calls themselves by expanding the mess_with_x idea to include the following calls listed in ascending priority order:

  • fiddle_about_with_x
  • mess_with_x
  • screw_around_with_x
  • have_your_way_with_x
dave reid’s picture

Status: Needs work » Fixed
Issue tags: +April Fools' Day

Happy April Fools' Day everyone. :)

Fidelix’s picture

JESUS CHRIST guys... lol.

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