Extend my own handler?

Events happening in the community are now at Drupal community events on www.drupal.org.
wodenx's picture

Hello again,
I'm wondering if there's any way to specify one custom field handler as the parent of another. In other words, I have a field handler in one module that extends views_handler_field_prerender_list. Now I'd like to implement a handler in another module that does much of the same processing with a small differrence - so i'd like it to extend my original handler. I'm not clear enough on the way Views handles code loading to know the best way to do this. Can I simply do

module_B_views_handlers() {
  return array(
    'info' => array(
      'path' => drupal_get_path('module', 'module_B') .'/views',
    ),
    'handlers' => array(
      'module_B_field_handler' => array(
        'parent' => 'module_A_field_handler',
      ),
    ),
  );
}

Seems unlikely, because how would Views know where to find the original handler?

Or, should I just include the code for the original handler in my new handler, and specify the same parent in HOOK_views_handlers?

Thanks

Comments

bump. anyone?

wodenx's picture

bump. anyone?

Did you try this? It should

Scott Reynolds's picture

Did you try this? It should totally work. Views handles the parentage just fine as long as module_A exists. In D7, you don't even need to specify the parent, because of D7's class registry.

Thanks - yes, it works

wodenx's picture

Thanks - yes, it works perfectly.

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week