Projet

Général

Profil

Paste
Télécharger (875 octets) Statistiques
| Branche: | Révision:

root / htmltest / sites / all / modules / addressfield / plugins / format / name-oneline.inc @ dc45a079

1
<?php
2

    
3
/**
4
 * @file
5
 * Generates a first name + last name format.
6
 */
7

    
8
$plugin = array(
9
  'title' => t('Name (single line)'),
10
  'format callback' => 'addressfield_format_name_oneline_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_oneline_generate(&$format, $address) {
21
  $format['name_block'] = array(
22
    '#type' => 'addressfield_container',
23
    '#attributes' => array('class' => array('addressfield-container-inline', 'name-block')),
24
    '#weight' => -100,
25
  );
26
  $format['name_block']['name_line'] = array(
27
    '#title' => t('Full name'),
28
    '#tag' => 'div',
29
    '#attributes' => array(
30
      'class' => array('name-block'),
31
      'x-autocompletetype' => 'name',
32
      'autocomplete' => 'name',
33
    ),
34
    '#size' => 30,
35
    '#required' => TRUE,
36
  );
37
}