I'm trying to build a couple of style plugins for the lineage module to expand its usefulness, but I'm somewhat hindered by the fact that I have have no idea what I'm doing. I tried to use the helpful infos at http://groups.drupal.org/node/10129 as a guideline, and tried to make a clone of the basic list style plugin to start (since one of the plugins I want to create is a nested list).
My style plugin shows up on my view's configuration page, and I can select it, configure its options, and so on; but any view I configure with this plugin displays the empty text. No error message, and the correct query appears to be run... but no rows displayed. Switch the view back to "HTML list" and it works fine. I'm undoubtedly forgetting something obvious...
In lineage/lineage.module:
<?php
/**
* Implementation of hook_views_api().
*/
function lineage_views_api() {
return array(
'api' => 2.0
);
}
?>In lineage/lineage.views.inc:
<?php
/**
* Implements hook_views_plugins().
*/
function lineage_views_plugins() {
return array(
'style' => array( // Declare the nested list style plugin.
'lineage_nested' => array(
'title' => t('Lineage nested list'),
'theme' => 'views-view-lineage-nested',
'help' => t('Displays rows in a nested list, grouped by term lineage'),
'handler' => 'views_plugin_style_lineage_nested',
'uses row plugin' => TRUE,
'uses fields' => TRUE,
'uses grouping' => TRUE,
'uses options' => TRUE,
'type' => 'normal',
),
'row' => array(
'parent' => array(
// this isn't really a display but is necessary so the file can
// be included.
'no ui' => TRUE,
'handler' => 'views_plugin_row',
'parent' => '',
),
'fields' => array(
'title' => t('Fields'),
'help' => t('Displays the fields with an optional template.'),
'handler' => 'views_plugin_row_fields',
'theme' => 'views_view_fields',
'uses fields' => TRUE,
'uses options' => TRUE,
'type' => 'normal',
'help topic' => 'style-row-fields',
),
),
)
);
?>** I think this might be the problem here but I'm not sure. I want to just inherit the default row handler, so at first I left it out, then added the above, copied directly from views/includes/plugins.inc.
In lineage/views_plugin_style_lineage_nested.inc:
<?php
/<strong>
* Implements views_plugin_style.
*/
class views_plugin_style_lineage_nested extends views_plugin_style {
/</strong>
* Set default options
*/
function option_definition() {
$options = parent::option_definition();
$options['type'] = array('default' => 'ul');
return $options;
}
/**
* Render the given style.
*/
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['type'] = array(
'#type' => 'radios',
'#title' => t('List type'),
'#options' => array('ul' => t('Unordered list'), 'ol' => t('Ordered list')),
'#default_value' => $this->options['type'],
);
}
}
?>This is again a straight clone from views/plugins/views_plugin_style_list.inc.
In lineage/views-view-lineage-nested.tpl.php:
<div class="item-list">
<?php if (!empty($title)) : ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<<?php print $options['type']; ?>>
<?php foreach ($rows as $id => $row): ?>
<li class="<?php print $classes[$id]; ?>"><?php print $row; ?></li>
<?php endforeach; ?>
</<?php print $options['type']; ?>>
</div>Again, just a clone of views/theme/views-view-list.tpl.php.
Can anyone give me a suggestion as to what I'm doing wrong (or not doing)?

Comments
Solved (?)
Looks like it was an issue with the theme path. I was able to get the view working as a clone of the list view by declaring an empty class that directly extends views_plugin_style_list, with the following plugin hook:
<?php/**
* Implements hook_views_plugins().
*/
function lineage_views_plugins() {
return array(
'style' => array( // Declare the nested list style plugin.
'lineage_nested' => array(
'title' => t('Lineage nested list'),
'theme' => 'views_view_list',
'theme file' => 'theme.inc',
'theme path' => drupal_get_path('module','views')."/theme",
'help' => t('Displays rows in a nested list, grouped by term lineage'),
'handler' => 'views_plugin_style_lineage_nested',
'uses row plugin' => TRUE,
'uses fields' => TRUE,
'uses grouping' => TRUE,
'uses options' => TRUE,
'type' => 'normal',
'parent' => 'list',
),
)
);
}
?>
When I first tried to extend the list class, I didn't realize I had to declare the 'parent' option to get views to load that plugin; for some reason I just assumed all those includes were included all the time. Silly in retrospect, but it would be great to add some documentation about that in the tutorial. It is somewhat sparsely documented in the advanced help under API-> plugins:
'parent' => 'page', // so it knows to load the page plugin .inc fileI read over that at least three times but didn't "get" that I needed to use it until I looked at some other modules' style plugin implementations.
As far as I can tell, the other key thing here is adding the theme path and theme.inc, which also don't get inherited by default. Without proper theme information, it seems that the view displays the empty text (with a pager, no less).