Extend my own handler?

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by wodenx on November 19, 2010 at 1:43pm

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?

Posted by wodenx on December 29, 2010 at 6:36pm

bump. anyone?

Did you try this? It should

Posted by Scott Reynolds on December 29, 2010 at 6:45pm

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

Posted by wodenx on January 14, 2011 at 1:20pm

Thanks - yes, it works perfectly.

Views Developers

Group organizers

Group notifications

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

AltStyle によって変換されたページ (->オリジナル) /