1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_handler_field_user_mail.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Field handler to provide acess control for the email field.
|
10
|
*
|
11
|
* @ingroup views_field_handlers
|
12
|
*/
|
13
|
class views_handler_field_user_mail extends views_handler_field_user {
|
14
|
|
15
|
/**
|
16
|
* {@inheritdoc}
|
17
|
*/
|
18
|
public function option_definition() {
|
19
|
$options = parent::option_definition();
|
20
|
$options['link_to_user'] = array('default' => 'mailto');
|
21
|
return $options;
|
22
|
}
|
23
|
|
24
|
/**
|
25
|
* {@inheritdoc}
|
26
|
*/
|
27
|
public function options_form(&$form, &$form_state) {
|
28
|
parent::options_form($form, $form_state);
|
29
|
$form['link_to_user'] = array(
|
30
|
'#title' => t('Link this field'),
|
31
|
'#type' => 'radios',
|
32
|
'#options' => array(
|
33
|
0 => t('No link'),
|
34
|
'user' => t('To the user'),
|
35
|
'mailto' => t("With a mailto:"),
|
36
|
),
|
37
|
'#default_value' => $this->options['link_to_user'],
|
38
|
);
|
39
|
}
|
40
|
|
41
|
/**
|
42
|
* {@inheritdoc}
|
43
|
*/
|
44
|
public function render_link($data, $values) {
|
45
|
parent::render_link($data, $values);
|
46
|
|
47
|
if ($this->options['link_to_user'] == 'mailto') {
|
48
|
$this->options['alter']['make_link'] = TRUE;
|
49
|
$this->options['alter']['path'] = "mailto:" . $data;
|
50
|
}
|
51
|
|
52
|
return $data;
|
53
|
}
|
54
|
|
55
|
}
|