1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Contains .
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Argument handler to accept a language.
|
10
|
*
|
11
|
* @ingroup views_argument_handlers
|
12
|
*/
|
13
|
class views_handler_argument_locale_group extends views_handler_argument {
|
14
|
|
15
|
/**
|
16
|
* {@inheritdoc}
|
17
|
*/
|
18
|
public function construct() {
|
19
|
parent::construct('group');
|
20
|
}
|
21
|
|
22
|
/**
|
23
|
* Override the behavior of summary_name(). Get the user friendly version
|
24
|
* of the group.
|
25
|
*/
|
26
|
public function summary_name($data) {
|
27
|
return $this->locale_group($data->{$this->name_alias});
|
28
|
}
|
29
|
|
30
|
/**
|
31
|
* Override the behavior of title(). Get the user friendly version
|
32
|
* of the language.
|
33
|
*/
|
34
|
public function title() {
|
35
|
return $this->locale_group($this->argument);
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* {@inheritdoc}
|
40
|
*/
|
41
|
public function locale_group($group) {
|
42
|
$groups = module_invoke_all('locale', 'groups');
|
43
|
// Sort the list.
|
44
|
asort($groups);
|
45
|
return isset($groups[$group]) ? $groups[$group] : t('Unknown group');
|
46
|
}
|
47
|
|
48
|
}
|