From 6ab6fc916b6e30b8ff6698feffe8ca46b9a57afb Mon Sep 17 00:00:00 2001 From: bachy Date: Tue, 7 Feb 2012 19:46:12 +0100 Subject: [PATCH] views integration start, not sure to keep that Signed-off-by: bachy --- tode.module | 17 +++++++++++ views/tode.views.inc | 33 ++++++++++++++++++++++ views/tode_views_handler_parent_filter.inc | 0 3 files changed, 50 insertions(+) create mode 100644 views/tode.views.inc create mode 100644 views/tode_views_handler_parent_filter.inc diff --git a/tode.module b/tode.module index ffa20d47..943c7540 100644 --- a/tode.module +++ b/tode.module @@ -33,6 +33,21 @@ function tode_menu() { } */ +/** + * Implements hook_views_api(). + */ +/* + TODO hook_views_api(). +*/ +// function tode_views_api() { +// return array( +// 'api' => 3, +// 'path' => drupal_get_path('module', 'tode') . '/views', +// ); +// } + + + /** * Implementation of hook_theme(). */ @@ -727,3 +742,5 @@ function _tode_get_tode_fields_def($node){ return $tode_fields; } + + diff --git a/views/tode.views.inc b/views/tode.views.inc new file mode 100644 index 00000000..bd1a6724 --- /dev/null +++ b/views/tode.views.inc @@ -0,0 +1,33 @@ + t('tode'), +// 'title' => t('Tode'), +// 'help' => t('Filtrer with tode parent term.'), // The help that appears on the UI, +// // 'real field' => 'field_pv_value', +// 'filter' => array( +// 'handler' => 'tode_views_handler_parent_filter', +// ), +// ); +// +// } + +function tode_views_data_alter(&$data) { + $data['tid']['tode_parent'] = array( + 'title' => t('Tode parent'), + 'group' => 'Tode', + 'help' => t('Parent term of tode field'), + 'real field' => 'field_tode_program', + 'filter' => array( + 'handler' => 'tode_views_handler_parent_filter', + ), + ); +} \ No newline at end of file diff --git a/views/tode_views_handler_parent_filter.inc b/views/tode_views_handler_parent_filter.inc new file mode 100644 index 00000000..e69de29b