name-oneline.inc 792 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @file
  4. * Generates a first name + last name format.
  5. */
  6. $plugin = array(
  7. 'title' => t('Name (single line)'),
  8. 'format callback' => 'addressfield_format_name_oneline_generate',
  9. 'type' => 'name',
  10. 'weight' => 0,
  11. );
  12. /**
  13. * Format callback.
  14. *
  15. * @see CALLBACK_addressfield_format_callback()
  16. */
  17. function addressfield_format_name_oneline_generate(&$format, $address) {
  18. $format['name_block'] = array(
  19. '#type' => 'addressfield_container',
  20. '#attributes' => array('class' => array('addressfield-container-inline', 'name-block')),
  21. '#weight' => -100,
  22. );
  23. $format['name_block']['name_line'] = array(
  24. '#title' => t('Full name'),
  25. '#tag' => 'div',
  26. '#attributes' => array('class' => array('name-block')),
  27. '#size' => 30,
  28. '#required' => TRUE,
  29. );
  30. }