Phase 5: Down the Rabbit Hole

Events happening in the community are now at Drupal community events on www.drupal.org.
You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

I've merged what was phase 6 and phase 7, too. They're both pie-in-the-sky long term stuff, plus if the context stack and drupal_get_context() doesn't go away then I'm not sure how necessary some of this stuff is. I am including it anyway for completeness.

Add to the context object a method named ->invokeHook($hook_name, array $args = array(), $context = NULL). The invokeHook() method will be used primarily by OO systems, which will use it in place of module_invoke_all() to allow the response to be mocked as appropriate.

Eventually, selected core systems will be given accessor methods on the context object, which will become the primary access to those systems. Examples of possible mechanisms include:

$context->db('slave')->query("...");

$context->theme($theme_key, $args);

Discussion points

  • Just how far do we let this take us?
  • How much of this will be necessary to support earlier phases, and how much is gravy?

Comments

$context argument?

donquixote's picture

What is the difference between
$context1->invokeHook($hook_name, $args, $context2)
and
$context2->invokeHook($hook_name, $args)
?

Mocking

Crell's picture

The former allows you to specify a new context object to pass to those hooks for them to use in place of the current context.

Ok, but why not directly

donquixote's picture

Ok, but why not directly $context2->invokeHook() ? This does only make sense if $context1 is still used somewhere.