~spreadubuntu/spreadubuntu/devel-drupal6

« back to all changes in this revision

Viewing changes to sites/all/modules/views/modules/locale/views_handler_argument_locale_group.inc

  • Committer: ruben
  • Date: 2009-06-08 09:38:49 UTC
  • Revision ID: ruben@captive-20090608093849-s1qtsyctv2vwp1x1
SpreadUbuntu moving to Drupal6. Based on ubuntu-drupal theme and adding our modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
// $Id: views_handler_argument_locale_group.inc,v 1.1 2009/02/20 23:02:09 merlinofchaos Exp $
 
3
 
 
4
/**
 
5
 * Argument handler to accept a language.
 
6
 */
 
7
class views_handler_argument_locale_group extends views_handler_argument {
 
8
  function construct() {
 
9
    parent::construct('group');
 
10
  }
 
11
 
 
12
  /**
 
13
   * Override the behavior of summary_name(). Get the user friendly version
 
14
   * of the group.
 
15
   */
 
16
  function summary_name($data) {
 
17
    return $this->locale_group($data->{$this->name_alias});
 
18
  }
 
19
 
 
20
  /**
 
21
   * Override the behavior of title(). Get the user friendly version
 
22
   * of the language.
 
23
   */
 
24
  function title() {
 
25
    return $this->locale_group($this->argument);
 
26
  }
 
27
 
 
28
  function locale_group($group) {
 
29
    $groups = module_invoke_all('locale', 'groups');
 
30
    // Sort the list.
 
31
    asort($groups);
 
32
    return isset($groups[$group]) ? $groups[$group] : t('Unknown group');
 
33
  }
 
34
}
 
35