1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Generates a first name + last name format.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
$plugin = array(
|
9 |
|
|
'title' => t('Name (First name, Last name)'),
|
10 |
|
|
'format callback' => 'addressfield_format_name_full_generate',
|
11 |
|
|
'type' => 'name',
|
12 |
|
|
'weight' => 0,
|
13 |
|
|
);
|
14 |
|
|
|
15 |
|
|
/**
|
16 |
|
|
* Format callback.
|
17 |
|
|
*
|
18 |
|
|
* @see CALLBACK_addressfield_format_callback()
|
19 |
|
|
*/
|
20 |
|
|
function addressfield_format_name_full_generate(&$format, $address) {
|
21 |
|
|
$format['name_block'] = array(
|
22 |
|
|
'#type' => 'addressfield_container',
|
23 |
|
|
'#attributes' => array(
|
24 |
|
|
'class' => array('addressfield-container-inline', 'name-block'),
|
25 |
|
|
),
|
26 |
|
|
'#weight' => -100,
|
27 |
|
|
);
|
28 |
|
|
$format['name_block']['first_name'] = array(
|
29 |
|
|
'#title' => t('First name'),
|
30 |
|
|
'#size' => 30,
|
31 |
|
|
'#required' => TRUE,
|
32 |
|
|
'#attributes' => array(
|
33 |
|
|
'class' => array('first-name'),
|
34 |
|
|
'x-autocompletetype' => 'given-name',
|
35 |
|
|
'autocomplete' => 'given-name',
|
36 |
|
|
),
|
37 |
|
|
);
|
38 |
|
|
$format['name_block']['last_name'] = array(
|
39 |
|
|
'#title' => t('Last name'),
|
40 |
|
|
'#size' => 30,
|
41 |
|
|
'#required' => TRUE,
|
42 |
|
|
'#prefix' => ' ',
|
43 |
|
|
'#attributes' => array(
|
44 |
|
|
'class' => array('last-name'),
|
45 |
|
|
'x-autocompletetype' => 'family-name',
|
46 |
|
|
'autocomplete' => 'family-name',
|
47 |
|
|
),
|
48 |
|
|
);
|
49 |
|
|
} |