fgcf.admin.inc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. // $Id$
  3. /**
  4. * @file
  5. * Admin pages for FGCF module
  6. *
  7. * @copyright (c) 2010 Ouest Systemes Informatiques (OSInet)
  8. *
  9. * @license General Public License version 2 or later
  10. *
  11. * @author Frederic G. MARAND (fgm@osinet.fr)
  12. *
  13. */
  14. /**
  15. * Implement the former hook_settings().
  16. *
  17. * @see fgcf_admin_settings_validate()
  18. *
  19. * @return array
  20. */
  21. function fgcf_admin_settings() {
  22. $form = array();
  23. $mail_destination = 'fgcf_mail_destination';
  24. $form[$mail_destination] = array(
  25. '#type' => 'textfield',
  26. '#title' => t("Destinataire des demandes d'inscription aux formations"),
  27. '#default_value' => variable_get($mail_destination, variable_get('site_mail', 'support@osinet.fr')),
  28. );
  29. $ret = system_settings_form($form);
  30. return $ret;
  31. }
  32. /**
  33. * Validation handler for fgcf_admin_settings().
  34. *
  35. * @param array $form
  36. * @param array $form_state
  37. *
  38. * @return void
  39. */
  40. function fgcf_admin_settings_validate($form, &$form_state) {
  41. $mail_destination = 'fgcf_mail_destination';
  42. if (!valid_email_address($form_state['values'][$mail_destination])) {
  43. form_set_error($mail_destination, t('Invalid email address'));
  44. }
  45. }