? i18ntaxonomy/includes Index: i18ntaxonomy/i18ntaxonomy.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/i18n/i18ntaxonomy/i18ntaxonomy.module,v retrieving revision 1.5.2.40 diff -u -p -r1.5.2.40 i18ntaxonomy.module --- i18ntaxonomy/i18ntaxonomy.module 24 Nov 2009 16:28:10 -0000 1.5.2.40 +++ i18ntaxonomy/i18ntaxonomy.module 25 Feb 2010 23:13:26 -0000 @@ -1038,4 +1038,14 @@ function _i18ntaxonomy_filter_terms($ter else { return is_object($term) ? $term : taxonomy_get_term($term); } -} \ No newline at end of file +} + +/** + * Implementation of hook_views_api(). + */ +function i18ntaxonomy_views_api() { + return array( + 'api' => '2.0', + 'path' => drupal_get_path('module', 'i18ntaxonomy') . '/includes', + ); +} Index: i18ntaxonomy/includes/i18ntaxonomy.views.inc =================================================================== RCS file: i18ntaxonomy/includes/i18ntaxonomy.views.inc diff -N i18ntaxonomy/includes/i18ntaxonomy.views.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ i18ntaxonomy/includes/i18ntaxonomy.views.inc 25 Feb 2010 23:13:26 -0000 @@ -0,0 +1,57 @@ + t('Term translation'), + 'title' => t('Language'), + 'help' => t('The language the term is in.'), + 'field' => array( + 'handler' => 'i18ntaxonomy_handler_field_term_language', + 'click sortable' => TRUE, + ), + 'filter' => array( + 'handler' => 'i18ntaxonomy_handler_filter_term_language', + ), + 'argument' => array( + 'handler' => 'i18ntaxonomy_handler_argument_term_language', + ), + ); +} + +/** + * Implementation of hook_views_handlers(). + */ +function i18ntaxonomy_views_handlers() { + return array( + 'info' => array( + 'path' => drupal_get_path('module', 'i18ntaxonomy') . '/includes', + ), + 'handlers' => array( + // field handlers + 'i18ntaxonomy_handler_field_term_language' => array( + 'parent' => 'views_handler_field_taxonomy', + ), + // filters + 'i18ntaxonomy_handler_filter_term_language' => array( + 'parent' => 'views_handler_filter_in_operator', + ), + // argument handlers + 'i18ntaxonomy_handler_argument_term_language' => array( + 'parent' => 'views_handler_argument', + ), + ), + ); +} Index: i18ntaxonomy/includes/i18ntaxonomy_handler_argument_term_language.inc =================================================================== RCS file: i18ntaxonomy/includes/i18ntaxonomy_handler_argument_term_language.inc diff -N i18ntaxonomy/includes/i18ntaxonomy_handler_argument_term_language.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ i18ntaxonomy/includes/i18ntaxonomy_handler_argument_term_language.inc 25 Feb 2010 23:13:26 -0000 @@ -0,0 +1,33 @@ +term_language($data->{$this->name_alias}); + } + + /** + * Override the behavior of title(). Get the user friendly version of the + * node type. + */ + function title() { + return $this->term_language($this->argument); + } + + function term_language($langcode) { + $languages = locale_language_list(); + return isset($languages[$langcode]) ? $languages[$langcode] : t('Unknown language'); + } +} + Index: i18ntaxonomy/includes/i18ntaxonomy_handler_field_term_language.inc =================================================================== RCS file: i18ntaxonomy/includes/i18ntaxonomy_handler_field_term_language.inc diff -N i18ntaxonomy/includes/i18ntaxonomy_handler_field_term_language.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ i18ntaxonomy/includes/i18ntaxonomy_handler_field_term_language.inc 25 Feb 2010 23:13:26 -0000 @@ -0,0 +1,13 @@ +{$this->field_alias}]) ? $languages[$values->{$this->field_alias}] : ''; + return $this->render_link($value, $values); + } +} Index: i18ntaxonomy/includes/i18ntaxonomy_handler_filter_term_language.inc =================================================================== RCS file: i18ntaxonomy/includes/i18ntaxonomy_handler_filter_term_language.inc diff -N i18ntaxonomy/includes/i18ntaxonomy_handler_filter_term_language.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ i18ntaxonomy/includes/i18ntaxonomy_handler_filter_term_language.inc 25 Feb 2010 23:13:26 -0000 @@ -0,0 +1,16 @@ +value_options)) { + $this->value_title = t('Language'); + $languages = array('***CURRENT_LANGUAGE***' => t("Current user's language"), '***DEFAULT_LANGUAGE***' => t("Default site language"), '***NO_LANGUAGE***' => t('No language')); + $languages = array_merge($languages, locale_language_list()); + $this->value_options = $languages; + } + } +}