Commit 00483d79 authored by generalredneck's avatar generalredneck

WIP: Adding Administrative UI and Plugin takeover for Table Display Style.

parent 20580b61
<?php
class views_natural_sort_plugin_style_table extends views_plugin_style_table {
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['#theme'] = 'views_natural_sort_style_plugin_table';
$form['vns_test'] = array(
'#markup' => "<h1>VNS TEST</h1>",
);
}
}
......@@ -8,4 +8,5 @@ core = 7.x
; Views handlers
files[] = handlers/views_natural_sort_handler_sort.inc
files[] = plugins/views_natural_sort_plugin_style_table.inc
files[] = views_natural_sort.test
......@@ -62,6 +62,95 @@ function views_natural_sort_module_implements_alter(&$implements, $hook) {
}
}
/**
* Implements hook_theme().
*/
function views_natural_sort_theme() {
return array(
'views_natural_sort_style_plugin_table' => array(
'render element' => 'form',
),
);
}
/**
* Theme the form for the table style plugin
*/
function theme_views_natural_sort_style_plugin_table($variables) {
$form = $variables['form'];
$output = drupal_render($form['description_markup']);
$header = array(
t('Field'),
t('Column'),
t('Align'),
t('Separator'),
array(
'data' => t('Sortable'),
'align' => 'center',
),
array(
'data' => t('Default order'),
'align' => 'center',
),
array(
'data' => t('Default sort'),
'align' => 'center',
),
array(
'data' => t('Sort Naturally'),
'align' => 'center',
),
array(
'data' => t('Hide empty column'),
'align' => 'center',
),
);
$rows = array();
foreach (element_children($form['columns']) as $id) {
$row = array();
$row[] = check_plain(drupal_render($form['info'][$id]['name']));
$row[] = drupal_render($form['columns'][$id]);
$row[] = drupal_render($form['info'][$id]['align']);
$row[] = drupal_render($form['info'][$id]['separator']);
if (!empty($form['info'][$id]['sortable'])) {
$row[] = array(
'data' => drupal_render($form['info'][$id]['sortable']),
'align' => 'center',
);
$row[] = array(
'data' => drupal_render($form['info'][$id]['default_sort_order']),
'align' => 'center',
);
$row[] = array(
'data' => drupal_render($form['default'][$id]),
'align' => 'center',
);
// TODO: ADD Natural Logic here.
$row[] = '';
}
else {
$row[] = '';
$row[] = '';
$row[] = '';
$row[] = '';
}
$row[] = array(
'data' => drupal_render($form['info'][$id]['empty_column']),
'align' => 'center',
);
$rows[] = $row;
}
// Add the special 'None' row.
$rows[] = array(t('None'), '', '', '', '', '', array('align' => 'center', 'data' => drupal_render($form['default'][-1])), '', '');
$output .= theme('table', array('header' => $header, 'rows' => $rows));
$output .= drupal_render_children($form);
return $output;
}
/**
* Implements hook_views_natural_sort_get_entry_types().
*/
......
......@@ -36,3 +36,14 @@ function views_natural_sort_views_data_alter(&$views_data) {
}
}
}
/**
* Implements hook_views_plugins_alter().
*/
function views_natural_sort_views_plugins_alter(&$plugins) {
// Add apachesolr to the base of the node row plugin.
$plugins['style']['table']['handler'] = 'views_natural_sort_plugin_style_table';
$plugins['style']['table']['path'] = drupal_get_path('module', 'views_natural_sort') . '/plugins';
$plugins['style']['table']['file'] = 'views_natural_sort_plugin_style_table.inc';
dpm($plugins);
}
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