Projet

Général

Profil

Paste
Télécharger (1,02 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / addressfield / plugins / format / organisation.inc @ f066bdb5

1
<?php
2

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

    
8
$plugin = array(
9
  'title' => t('Organisation (single line)'),
10
  'format callback' => 'addressfield_format_organisation_generate',
11
  'type' => 'organisation',
12
  'weight' => -10,
13
);
14

    
15
/**
16
 * Format callback.
17
 *
18
 * @see CALLBACK_addressfield_format_callback()
19
 */
20
function addressfield_format_organisation_generate(&$format, $address) {
21
  $format['organisation_block'] = array(
22
    '#type' => 'addressfield_container',
23
    '#attributes' => array('class' => array('addressfield-container-inline', 'name-block')),
24
    '#weight' => -50,
25
    // The addressfield is considered empty without a country, hide all fields
26
    // until one is selected.
27
    '#access' => !empty($address['country']),
28
  );
29
  $format['organisation_block']['organisation_name'] = array(
30
    '#title' => t('Company'),
31
    '#size' => 30,
32
    '#attributes' => array(
33
      'class' => array('organisation-name'),
34
      'x-autocompletetype' => 'organization',
35
      'autocomplete' => 'organization',
36
    ),
37
  );
38
}