organisation.inc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @file
  4. * Generates a first name + last name format.
  5. */
  6. $plugin = array(
  7. 'title' => t('Organisation (single line)'),
  8. 'format callback' => 'addressfield_format_organisation_generate',
  9. 'type' => 'organisation',
  10. 'weight' => -10,
  11. );
  12. /**
  13. * Format callback.
  14. *
  15. * @see CALLBACK_addressfield_format_callback()
  16. */
  17. function addressfield_format_organisation_generate(&$format, $address) {
  18. $format['organisation_block'] = array(
  19. '#type' => 'addressfield_container',
  20. '#attributes' => array('class' => array('addressfield-container-inline', 'organisation-block')),
  21. '#weight' => -50,
  22. // The addressfield is considered empty without a country, hide all fields
  23. // until one is selected.
  24. '#access' => !empty($address['country']),
  25. );
  26. $format['organisation_block']['organisation_name'] = array(
  27. '#title' => t('Company'),
  28. '#size' => 30,
  29. '#maxlength' => 255,
  30. '#attributes' => array(
  31. 'class' => array('organisation-name'),
  32. 'autocomplete' => 'organization',
  33. ),
  34. );
  35. }