Commit c01f577a authored by merlinofchaos's avatar merlinofchaos

Simple form of node_view plugin

parent 2bd5f0a0
......@@ -67,7 +67,7 @@ function views_views_plugins() {
),
'fields_summary' => array(
'title' => t('Summary'),
'help' => t('Displays the link to the argument and the node count.'),
'help' => t('Displays the link to the argument and the row count.'),
'handler' => 'views_row_plugin_summary',
'theme' => 'views_view_row_summary',
),
......@@ -351,6 +351,7 @@ class views_style_plugin extends views_object {
class views_style_plugin_default extends views_style_plugin {
// TEMP HACK
var $row_plugin = 'views_row_plugin';
// var $row_plugin = 'views_row_plugin_node_view';
function options_form(&$form) {
// provide an option form to select from our list of node renderers
}
......
......@@ -39,16 +39,6 @@ function node_views_data() {
'arguments' => array('node', 'node_revisions', 'nid', 'nid'),
),
);
// Provide output plugins specifically for this base type.
$data['node']['table']['plugins'] = array(
'row' => array(
'node' => array(
'title' => t('Node'),
'help' => t('Display the node with standard node view.'),
'handler' => 'views_row_plugin_node_view',
),
),
);
// ----------------------------------------------------------------
// Fields
......@@ -331,6 +321,59 @@ class views_handler_argument_node_nid extends views_handler_argument {
}
}
/**
* Implementation of hook_views_plugins
*/
function node_views_plugins() {
return array(
'module' => 'views', // This just tells our themes are elsewhere.
'row' => array(
'node' => array(
'title' => t('Node'),
'help' => t('Display the node with standard node view.'),
'handler' => 'views_row_plugin_node_view',
'theme' => 'views_view_row_node',
'base' => array('node'), // only works with 'node' as base.
),
),
);
}
/**
* Plugin which performs a node_view on the resulting object.
*
* @ingroup views_row_plugins
*/
class views_row_plugin_node_view extends views_object {
/**
* Override the behavior of the render() function.
*/
function render(&$view, $row) {
return theme(array('views_view_row_node__' . $view->name, 'views_view_row_node'), $view, $row);
}
}
/**
* Template helper for theme_views_view_row_node
*/
function template_preprocess_views_view_row_node(&$vars) {
$vars['node'] = ''; // make sure var is defined.
$nid = $vars['row']->nid;
if (!is_numeric($nid)) {
return;
}
$node = node_load($nid);
if (empty($node)) {
return;
}
// @todo add settings so that this can choose teaser, links, etc.
$vars['node'] = node_view($node, TRUE);
}
/**
* @}
*/
......@@ -358,13 +358,15 @@ function views_discover_plugins() {
if (!is_array($result)) {
continue;
}
$module_dir = isset($result['module']) ? $result['module'] : $module;
// Setup automatic path/file finding for theme registration
if (isset($result['module']) && $result['module'] == 'views') {
$path = drupal_get_path('module', $module) . '/theme';
if ($module_dir == 'views') {
$path = drupal_get_path('module', $module_dir) . '/theme';
$file = 'theme.inc';
}
else {
$path = drupal_get_path('module', $module);
$path = drupal_get_path('module', $module_dir);
$file = "$module.views.inc";
}
foreach ($result as $type => $info) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment