Extending "Base Parent" Row Plugin Class; Class Not Found

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

When writing a row plugin module to extend the base parent row class, fatal error returned, stating: "Class 'views_plugin_row' not found . . ." On consultation with merlinofchaos (on IRC), referred to http://views-help.doc.logrus.com/help/views/api-plugins.

That page states: "[T]here is an optional parent directive which is automatically filled in to be the base parent for the plugin type. Usually this is enough, but if your plugin derives from something other than the base, it must be filled in." The thrust of this is that I have to define a 'parent' element in the returned array in my implementation of hook_views_plugins(), for my row plugin, assuming I am extending something other than the base parent.

I beleive I am attempting to derive from the base parent, which I assume, from looking at the Views module plugins.inc code, is "views_plugin_row." Is this correct? If so, it would seem that I do not need to define a 'parent' element to the returned array in my implementation of hook_views_plugins() for my row plugin. Even so, I tried it, just in case, by defining the element as 'parent' => 'parent'. Please help!

Here are some relevant code sections:

<?php
16
function orgchart_views_plugins() {
17   return array(
18     'row' => array( // Handle custom output of rows for the orgchart
19       'persons' => array(
20         'title' => t('Persons'),
21         'help' => t('Display each record as a person, with an optional headshot.'),
22         'handler' => 'orgcharg_plugin_row_persons',
23         'theme' => 'orgcharg_views_persons',
24         'uses fields' => TRUE,
25         'uses options' => TRUE,
26         'type' => 'normal',
27         'parent' => 'parent',
28         'base' => array('node'), // only works with 'node' as base.
29         'type' => 'normal,
30       ),
31     ),
32   );
33 }
?>

<?php
42
class orgchart_plugin_row_persons extends views_plugin_row {
?>

I should note, cache was cleared by using the menu item defined in the Devel module.

Comments

You were so close and yet

merlinofchaos's picture

You were so close and yet somehow you veered left and slammed into the wall for no reason.

'parent' => 'views_plugin_row',

Merlinofchaos -- I was

Morris Singer's picture

Merlinofchaos --

I was looking at the line in that URL you gave me that says: "Note that unlike handler registration, where parentage is referred to by object name, with plugins it is referred to by the unique plugin identifier."

Thanks for the help. I made the change and refreshed my cache, to no avail. Is there a trick to this that I am missing?

For those

Garrett Albright's picture

For those confused… merlinofchaos actually misspoke here; the 'parent' param should be set to 'parent'. Better yet, just omit the parameter entirely from your hook_views_plugins() and Views will define it with 'parent' as its default value itself.

Hm. I note your plugin

merlinofchaos's picture

Hm. I note your plugin starts on line 16. What file is it in?

Morris Singer's picture

The fifteen lines that come before my code excerpt are simply the open-PHP bracket and some comments.

Your plugin needs to be in a

merlinofchaos's picture

Your plugin needs to be in a separate file. The plugin file is only included upon request, which is also true of the plugin's parent. That's the whole reason for registration. That's why you're having problems.

Views Developers

Group organizers

Group notifications

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